Skip to content

Commit aafc6ee

Browse files
committed
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.
1 parent a849a50 commit aafc6ee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/adapters/application.js

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import RESTAdapter from '@ember-data/adapter/rest';
33
export default class ApplicationAdapter extends RESTAdapter {
44
namespace = 'api/v1';
55

6+
isInvalid() {
7+
// HTTP 422 errors are causing all sorts of issues within Ember Data,
8+
// so we disable their special case handling here, since we don't need/want it.
9+
return false;
10+
}
11+
612
handleResponse(status, headers, payload, requestData) {
713
if (typeof payload === 'string') {
814
try {

0 commit comments

Comments
 (0)