Skip to content

Commit

Permalink
fix: catch promise error
Browse files Browse the repository at this point in the history
  • Loading branch information
18alantom committed Feb 25, 2022
1 parent 0109296 commit e9b52c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/dataImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function formatValue(value: string, fieldtype: FieldType): unknown {
return new Date(value);
case FieldType.Currency:
// @ts-ignore
return frappe.pesa(value);
return frappe.pesa(value || 0);
case FieldType.Int:
case FieldType.Float: {
const n = parseFloat(value);
Expand Down Expand Up @@ -364,9 +364,9 @@ export class Importer {
}

const doc = frappe.getNewDoc(this.doctype);
await doc.set(docObj);

try {
await doc.set(docObj);
await doc.insert();
if (this.shouldSubmit) {
await doc.submit();
Expand Down
6 changes: 5 additions & 1 deletion src/pages/DataImport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
:key="'matrix-row-' + i"
>
<button
class="w-4 h-4 text-gray-600 hover:text-gray-900 cursor-pointer"
class="w-4 h-4 text-gray-600 hover:text-gray-900 cursor-pointer outline-none"
@click="
() => {
importer.dropRow(i);
Expand Down Expand Up @@ -443,6 +443,10 @@ export default {
},
},
deactivated() {
if (!this.complete) {
return;
}
this.clear();
},
methods: {
Expand Down

0 comments on commit e9b52c8

Please sign in to comment.