simple-translate/src/common/getErrorMessage.js

18 lines
477 B
JavaScript
Raw Normal View History

2019-02-22 17:30:34 +00:00
import browser from "webextension-polyfill";
export default statusText => {
let errorMessage = "";
switch (statusText) {
case "Network Error":
errorMessage = browser.i18n.getMessage("networkError");
break;
case "Service Unavailable":
errorMessage = browser.i18n.getMessage("unavailableError");
break;
default:
errorMessage = `${browser.i18n.getMessage("unknownError")} [${statusText}]`;
break;
}
return errorMessage;
};