Skip to content

Commit ffb3592

Browse files
authored
fix: add return code 400 Bad Request (#605)
Added an error response code to make 400 errors visible to the app. This code is emitted by the backend when refusing a patch update to `/api/caregivers/profile/` due to an unsupported language.
1 parent c5097f8 commit ffb3592

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/core/api-request.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ class ApiRequest {
7777
const errorData = !error.response ? null : ApiRequest.filterOutHTML(error.response.data);
7878
let opalError;
7979
switch (errorCode) {
80+
case 400:
81+
opalError = 'BAD_REQUEST';
82+
break;
8083
case 404:
8184
opalError = 'API_NOT_FOUND';
8285
break;

src/error/const.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
* because of the error.
1212
*/
1313
const ERRORS = {
14+
BAD_REQUEST: {
15+
statusCode: 400,
16+
logMessage: 'Server would not process request due to client error',
17+
clientMessage: 'BAD_REQUEST',
18+
encrypt: false,
19+
},
1420
SNAPSHOT_VALIDATION: {
1521
statusCode: 400,
1622
logMessage: 'Firebase snapshot invalid',

0 commit comments

Comments
 (0)