A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: handle crashes during export
Abdullah Atta13befe19478a
diff --git a/apps/web/src/common/export.ts b/apps/web/src/common/export.tsindex 4ef8e3a94..ebee275e7 100644--- a/apps/web/src/common/export.ts+++ b/apps/web/src/common/export.ts@@ -100,17 +100,26 @@ export async function exportNotes(};}});- confirm({- title: `Exported ${result.count} notes`,- message:- result.errors.length > 0- ? `Export completed with ${result.errors.length} errors:+ if (result instanceof Error) {+ confirm({+ title: `Export failed`,+ message: result.stack || result.message,+ positiveButtonText: "Okay"+ });+ return false;+ } else {+ confirm({+ title: `Exported ${result.count} notes`,+ message:+ result.errors.length > 0+ ? `Export completed with ${result.errors.length} errors:${result.errors.map((e, i) => `${i + 1}. ${e.message}`).join("\n")}`- : "Export completed with 0 errors.",- positiveButtonText: "Okay"- });- return true;+ : "Export completed with 0 errors.",+ positiveButtonText: "Okay"+ });+ return true;+ }}const FORMAT_TO_EXT = {diff --git a/apps/web/src/common/task-manager.ts b/apps/web/src/common/task-manager.tsindex ab73e0b04..9e4b0bac7 100644--- a/apps/web/src/common/task-manager.ts+++ b/apps/web/src/common/task-manager.ts@@ -55,7 +55,7 @@ type TaskProgress = {type ProgressReportCallback = (progress: TaskProgress) => void;export class TaskManager {- static async startTask<T>(task: TaskDefinition<T>): Promise<T> {+ static async startTask<T>(task: TaskDefinition<T>): Promise<T | Error> {switch (task.type) {case "status": {const statusTask = task;@@ -74,7 +74,7 @@ export class TaskManager {return result;}case "modal": {- return await showProgressDialog<T>({+ return await showProgressDialog<T | Error>({title: task.title,subtitle: task.subtitle,action: task.action