From 46cd64b08bf430ec584f2889c9dbf36669db5391 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 29 Jun 2017 22:04:11 +0100 Subject: [PATCH] minor changes --- CliClient/app/import-enex.js | 2 +- CliClient/app/main.js | 6 ++++-- lib/onedrive-api.js | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CliClient/app/import-enex.js b/CliClient/app/import-enex.js index 8d572b7d60..846be95390 100644 --- a/CliClient/app/import-enex.js +++ b/CliClient/app/import-enex.js @@ -146,7 +146,7 @@ function importEnex(parentFolderId, filePath, importOptions = null) { let processingNotes = false; stream.on('error', (error) => { - importOptions.onError(error); + reject(new Error(error.toString())); }); function currentNodeName() { diff --git a/CliClient/app/main.js b/CliClient/app/main.js index 55e8915e1d..f47e655368 100644 --- a/CliClient/app/main.js +++ b/CliClient/app/main.js @@ -346,6 +346,7 @@ commands.push({ ['--fuzzy-matching', 'For debugging purposes. Do not use.'], ], action: async function(args, end) { + let redrawnCalled = false; try { let filePath = args.file; let folder = null; @@ -384,7 +385,6 @@ commands.push({ return; } - let redrawnCalled = false; let options = { fuzzyMatching: args.options['fuzzy-matching'] === true, onProgress: (progressState) => { @@ -398,6 +398,7 @@ commands.push({ vorpal.ui.redraw(line.join(' ')); }, onError: (error) => { + if (redrawnCalled) vorpal.ui.redraw.done(); let s = error.trace ? error.trace : error.toString(); this.log(s); }, @@ -406,12 +407,13 @@ commands.push({ folder = !folder ? await Folder.save({ title: folderTitle }) : folder; this.log(_('Importing notes...')); await importEnex(folder.id, filePath, options); - if (redrawnCalled) vorpal.ui.redraw.done(); this.log(_('Done.')); } catch (error) { this.log(error); } + if (redrawnCalled) vorpal.ui.redraw.done(); + end(); }, }); diff --git a/lib/onedrive-api.js b/lib/onedrive-api.js index 4ca1cee469..5bb61635a7 100644 --- a/lib/onedrive-api.js +++ b/lib/onedrive-api.js @@ -232,6 +232,8 @@ class OneDriveApi { if (!r.ok) { errorMessage = 'Could not retrieve auth code: ' + r.status + ': ' + r.statusText; writeResponse(400, errorMessage); + targetConsole.log(''); + targetConsole.log(errorMessage); server.destroy(); return; } @@ -239,6 +241,8 @@ class OneDriveApi { return r.json().then((json) => { this.auth_ = json; writeResponse(200, 'The application has been authorised - you may now close this browser tab.'); + targetConsole.log(''); + targetConsole.log('The application has been successfully authorised.'); server.destroy(); }); });