Skip to content

Commit

Permalink
adapters/application: Disable special case handling of 422 errors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Turbo87 committed Dec 11, 2024
1 parent a849a50 commit aafc6ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit aafc6ee

Please sign in to comment.