diff --git a/app/src/api/errors.js b/app/src/api/errors.js index f120ac02..e8648d3a 100644 --- a/app/src/api/errors.js +++ b/app/src/api/errors.js @@ -7,8 +7,8 @@ import i18n from '@/i18n' class APIError extends Error { - constructor (request, { url, status, statusText }, errorData) { - super(errorData.error || i18n.t('error_server_unexpected')) + constructor (request, { url, status, statusText }, { error }) { + super(error ? error.replace('\n', '
') : i18n.t('error_server_unexpected')) const urlObj = new URL(url) this.name = 'APIError' this.code = status diff --git a/app/src/api/handlers.js b/app/src/api/handlers.js index 259e5d2d..123797da 100644 --- a/app/src/api/handlers.js +++ b/app/src/api/handlers.js @@ -59,7 +59,7 @@ export async function handleError (request, response, errorData) { let errorCode = response.status in errors ? response.status : undefined if (typeof errorData === 'string') { // FIXME API: Patching errors that are plain text or html. - errorData = { error: errorData.replace('\n', '
') } + errorData = { error: errorData } } if ('log_ref' in errorData) { // Define a special error so it won't get caught as a `APIBadRequestError`. diff --git a/app/src/views/tool/ToolMigrations.vue b/app/src/views/tool/ToolMigrations.vue index 400b3627..823490dc 100644 --- a/app/src/views/tool/ToolMigrations.vue +++ b/app/src/views/tool/ToolMigrations.vue @@ -121,7 +121,7 @@ export default { } // Check that every migration's disclaimer has been checked. if (Object.values(this.checked).every(value => value === true)) { - api.post('migrations/run', { accept_disclaimer: true }).then(() => { + api.post('migrations/run?accept_disclaimer').then(() => { this.$refs.view.fetchQueries() }) } @@ -131,7 +131,7 @@ export default { const confirmed = await this.$askConfirmation(this.$i18n.t('confirm_migrations_skip')) if (!confirmed) return - api.post('/migrations/run', { skip: true, targets: id }).then(() => { + api.post('/migrations/run', { skip: '', targets: id }).then(() => { this.$refs.view.fetchQueries() }) }