mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
fix: throw Error object
This commit is contained in:
parent
a12fc981bb
commit
dc41c0b775
4
index.js
4
index.js
@ -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);
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user