diff --git a/index.js b/index.js index 6ac75aa2..23a6684b 100644 --- a/index.js +++ b/index.js @@ -97,7 +97,7 @@ module.exports = { if (this.methods[method]) { return await this.methods[method](args); } else { - throw `${method} not found`; + throw new Error(`${method} not found`); } } @@ -155,7 +155,7 @@ module.exports = { if (!this.metaCache[doctype]) { let model = this.models[doctype]; if (!model) { - throw `${doctype} is not a registered doctype`; + throw new Error(`${doctype} is not a registered doctype`); } let metaClass = model.metaClass || this.BaseMeta; this.metaCache[doctype] = new metaClass(model); diff --git a/utils/numberFormat.js b/utils/numberFormat.js index a7a54ee6..fee4a11a 100644 --- a/utils/numberFormat.js +++ b/utils/numberFormat.js @@ -85,7 +85,7 @@ module.exports = { let format_info = numberFormats[format]; if (!format_info) { - throw `Unknown number format "${format}"`; + throw new Error(`Unknown number format "${format}"`); } return format_info;