2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

fix: remove unnecessary try-catch

This commit is contained in:
18alantom 2022-01-07 12:22:40 +05:30
parent 01609def72
commit 490837a5e1

View File

@ -20,10 +20,8 @@ module.exports = {
currency ??= 'XXX'; currency ??= 'XXX';
// to be called after db initialization // to be called after db initialization
let values; const values =
try { (await frappe.db?.getSingleValues(
// error thrown if migration hasn't taken place
values = await frappe.db.getSingleValues(
{ {
fieldname: 'internalPrecision', fieldname: 'internalPrecision',
parent: 'SystemSettings', parent: 'SystemSettings',
@ -32,10 +30,7 @@ module.exports = {
fieldname: 'displayPrecision', fieldname: 'displayPrecision',
parent: 'SystemSettings', parent: 'SystemSettings',
} }
); )) ?? [];
} catch {
values = [];
}
let { internalPrecision: precision, displayPrecision: display } = let { internalPrecision: precision, displayPrecision: display } =
values.reduce((acc, { fieldname, value }) => { values.reduce((acc, { fieldname, value }) => {
@ -47,7 +42,7 @@ module.exports = {
precision = DEFAULT_INTERNAL_PRECISION; precision = DEFAULT_INTERNAL_PRECISION;
} }
if (typeof precision.value === 'string') { if (typeof precision === 'string') {
precision = parseInt(precision); precision = parseInt(precision);
} }