2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 19:39:07 +00:00

fix: more informative error messages

- set currency columns as not null
This commit is contained in:
18alantom 2021-12-29 11:43:39 +05:30
parent e249b033f1
commit 84724ff731
2 changed files with 10 additions and 2 deletions

View File

@ -163,7 +163,10 @@ module.exports = class Database extends Observable {
}
// required
if (!!field.required && !(field.required instanceof Function)) {
if (
(!!field.required && !(field.required instanceof Function)) ||
field.fieldtype === 'Currency'
) {
column.notNullable();
}

View File

@ -668,7 +668,12 @@ module.exports = class BaseDocument extends Observable {
.map((d) => {
const value = d[childfield] ?? 0;
if (!isPesa(value)) {
return frappe.pesa(value);
try {
return frappe.pesa(value);
} catch (err) {
err.message += ` value: '${value}' of type: ${typeof value}, fieldname: '${tablefield}', childfield: '${childfield}'`;
throw err;
}
}
return value;
})