cimpress-translations
Version:
Lightweight client for the Translations Service
24 lines (19 loc) • 659 B
JavaScript
;
var errors = {
"EGENERIC": "An unspecified error has occured.",
"ENOTFOUND": "The service does not exist or does not support this language.",
"ENOACCESS": "You are not authenticated or authorized to read this information.",
"ENOLANG": "The specified language could not be found in the ISO 639-2 database.",
"EBADREQUEST": "The provided request body contains one or multiple errors."
};
var buildError = function buildError(name, message) {
var err = new Error(errors[name]);
err.name = name;
if (message) {
err.message = message;
}
return err;
};
module.exports = Object.assign(errors, {
buildError: buildError
});