Fix language not found not responding

This commit is contained in:
1computer1 2019-07-24 06:01:17 -04:00
parent 481a9978d5
commit 8b25b609c6

View file

@ -21,7 +21,7 @@ class Myriad {
}); });
if (!response.ok) { if (!response.ok) {
if (response.status === 404 && /^Language .+? was not found$/.test(response.statusText)) { if (response.status === 404 && response.statusText === 'Not Found') {
return [false, 'Invalid language']; return [false, 'Invalid language'];
} }
@ -33,7 +33,7 @@ class Myriad {
return [false, 'Evaluation timed out']; return [false, 'Evaluation timed out'];
} }
throw new Error(`Unexpected ${response.status} response from ['Myriad', ${response.statusText}`); throw new Error(`Unexpected ${response.status} response from Myriad, ${response.statusText}`);
} }
const body = await response.json(); const body = await response.json();