2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00

fix: throw Error object

This commit is contained in:
Faris Ansari 2019-10-08 16:46:12 +05:30
parent a12fc981bb
commit dc41c0b775
2 changed files with 3 additions and 3 deletions

View File

@ -97,7 +97,7 @@ module.exports = {
if (this.methods[method]) { if (this.methods[method]) {
return await this.methods[method](args); return await this.methods[method](args);
} else { } else {
throw `${method} not found`; throw new Error(`${method} not found`);
} }
} }
@ -155,7 +155,7 @@ module.exports = {
if (!this.metaCache[doctype]) { if (!this.metaCache[doctype]) {
let model = this.models[doctype]; let model = this.models[doctype];
if (!model) { if (!model) {
throw `${doctype} is not a registered doctype`; throw new Error(`${doctype} is not a registered doctype`);
} }
let metaClass = model.metaClass || this.BaseMeta; let metaClass = model.metaClass || this.BaseMeta;
this.metaCache[doctype] = new metaClass(model); this.metaCache[doctype] = new metaClass(model);

View File

@ -85,7 +85,7 @@ module.exports = {
let format_info = numberFormats[format]; let format_info = numberFormats[format];
if (!format_info) { if (!format_info) {
throw `Unknown number format "${format}"`; throw new Error(`Unknown number format "${format}"`);
} }
return format_info; return format_info;