1
0
Fork 0

Fix fetch doesn't throw error when 500

This commit is contained in:
Lim Chee Aun 2023-10-25 00:13:42 +08:00
parent 05ee27e045
commit f19326528b

View file

@ -35,7 +35,10 @@ function _lingvaTranslate(text, source, target) {
text,
)}`,
)
.then((res) => res.json())
.then((res) => {
if (!res.ok) throw new Error(res.statusText);
return res.json();
})
.then((res) => {
return {
provider: 'lingva',