Skip to content

Commit

Permalink
Display the error from the translation server, if it occurs. Fix #585
Browse files Browse the repository at this point in the history
  • Loading branch information
tnajdek committed Jan 29, 2025
1 parent e9cd29f commit 72c5ff2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/js/actions/identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ const searchIdentifier = (identifier, { shouldImport = false } = {}) => {
response
});
return items;
} else if (response.status === 500 && response.headers.get('content-type').startsWith('text/plain')) {
const message = await response.text();
dispatch({ type: RECEIVE_ADD_BY_IDENTIFIER, identifier, identifierIsUrl, result: EMPTY, message, import: shouldImport });
} else if(response.status !== 200) {
const message = 'Unexpected response from the server.';
const message = `Unexpected response from the server (${response.status}).`;
dispatch({ type: RECEIVE_ADD_BY_IDENTIFIER, identifier, identifierIsUrl, result: EMPTY, message, import: shouldImport });
} else if (!response.headers.get('content-type').startsWith('application/json')) {
const message = 'Unexpected response from the server.';
Expand Down

0 comments on commit 72c5ff2

Please sign in to comment.