Better error handling in CorpusAnalysisApp

This commit is contained in:
Patrick Jentsch
2023-07-18 17:18:04 +02:00
parent e4f435c5ee
commit 7a925b6a19
3 changed files with 25 additions and 17 deletions

View File

@ -30,7 +30,11 @@ cqi.api.APIClient = class APIClient {
} else if (response.code === 500) {
throw new Error(`[${response.code}] ${response.msg}`);
} else if (response.code === 502) {
throw new cqi.errors.lookup[response.payload.code]();
if (response.payload.code in cqi.errors.lookup) {
throw new cqi.errors.lookup[response.payload.code]();
} else {
throw new cqi.errors.CQiError();
}
}
}