From 538aec6ef5639f583a7ed9ce9b5cbf085c846537 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 22 May 2017 10:41:47 +0200 Subject: [PATCH] Display a message when pinPads returns an error --- customize.dist/translations/messages.fr.js | 1 + customize.dist/translations/messages.js | 1 + www/common/userObject.js | 5 ++++- www/drive/main.js | 9 ++++++--- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 5db44bf2d..2302a1d62 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -247,6 +247,7 @@ define(function () { 'nos raisons pour ces changements et pourquoi vous devriez vraiment vous enregistrer et vous connecter.'; out.fm_backup_title = 'Lien de secours'; out.fm_nameFile = 'Comment souhaitez-vous nommer ce fichier ?'; + out.fm_error_cantPin = "Erreur interne du serveur. Veuillez recharger la page et essayer de nouveau."; // File - Context menu out.fc_newfolder = "Nouveau dossier"; out.fc_rename = "Renommer"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 8a1de05a5..69e9cc3c2 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -249,6 +249,7 @@ define(function () { 'why we are doing this and why you really should Sign up and Log in.'; out.fm_backup_title = 'Backup link'; out.fm_nameFile = 'How would you like to name that file?'; + out.fm_error_cantPin = "Internal server error. Please reload the page and try again."; // File - Context menu out.fc_newfolder = "New folder"; out.fc_rename = "Rename"; diff --git a/www/common/userObject.js b/www/common/userObject.js index 51840dca5..1559397d0 100644 --- a/www/common/userObject.js +++ b/www/common/userObject.js @@ -575,7 +575,10 @@ define([ atime: +new Date(), ctime: +new Date() }, function (err) { - if (err) { return void cb(err); } + if (err) { + logError(err); + return void cb(err); + } parentEl[fileName] = href; var newPath = filePath.slice(); newPath.push(fileName); diff --git a/www/drive/main.js b/www/drive/main.js index a85c86e47..861136454 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -1397,8 +1397,11 @@ define([ // Handlers if (isInRoot) { var onCreated = function (err, info) { - if (err && err === E_OVER_LIMIT) { - return void Cryptpad.alert(Messages.pinLimitDrive, null, true); + if (err) { + if (err === E_OVER_LIMIT) { + return void Cryptpad.alert(Messages.pinLimitDrive, null, true); + } + return void Cryptpad.alert(Messages.fm_error_cantPin); } module.newFolder = info.newPath; refresh(); @@ -2361,7 +2364,7 @@ define([ return void Cryptpad.alert(Messages.pinLimitDrive, null, true); } if (err) { - return void console.error("Unable to create the file", err); + return void Cryptpad.alert(Messages.fm_error_cantPin); } module.newFolder = info.newPath; refresh();