simple-translate/src/common/getErrorMessage.js
2019-02-23 02:30:34 +09:00

18 lines
477 B
JavaScript

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;
};