Skip to content

Commit

Permalink
[FIX] display clear message for unexpected errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sbejaoui committed Dec 25, 2023
1 parent e93ba12 commit ecde01f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions shopfloor_mobile_base/static/wms/src/services/odoo.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ export class OdooMixin {
if (_.isUndefined(handler)) {
handler = this._handle_error;
}
return response.json().then((json) => {
return {error: handler.call(this, response, json)};
return response.text().then((text) => {
return {
error: handler.call(this, response, {
description: $(text).slice(-1),
}),
};
});
}
return response.json();
Expand All @@ -78,6 +82,7 @@ export class OdooMixin {
error: response.statusText,
status: response.status,
response: response,
name: response.statusText,
});
}
_handle_404(response, json) {
Expand Down

0 comments on commit ecde01f

Please sign in to comment.