From aafc6ee4d14bfc918ec92cfcf8df41173289f021 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Mon, 9 Dec 2024 17:06:39 +0100 Subject: [PATCH] adapters/application: Disable special case handling of 422 errors The crate deletion endpoint is our first one that uses "422 Unprocessable Entity" HTTP errors, but it looks like Ember Data is expecting a slightly different layout for them. Since we don't need the special handling code in Ember Data, we can disable the extra code path and treat them like any other 4xx error. --- app/adapters/application.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/adapters/application.js b/app/adapters/application.js index 508db496b4..5798b0dd38 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -3,6 +3,12 @@ import RESTAdapter from '@ember-data/adapter/rest'; export default class ApplicationAdapter extends RESTAdapter { namespace = 'api/v1'; + isInvalid() { + // HTTP 422 errors are causing all sorts of issues within Ember Data, + // so we disable their special case handling here, since we don't need/want it. + return false; + } + handleResponse(status, headers, payload, requestData) { if (typeof payload === 'string') { try {