From 861b8a44500713b2a106716e21ed02f934094f6a Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Tue, 1 Aug 2017 17:35:45 -0400 Subject: [PATCH] fix(GUI): throw a user error if the user is not in the sudoers file (#1620) Change-Type: patch Changelog-Entry: Display a user-friendly error message if the user is not in the sudoers file. Signed-off-by: Juan Cruz Viotti --- lib/shared/permissions.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/shared/permissions.js b/lib/shared/permissions.js index a9cce645..adb54374 100644 --- a/lib/shared/permissions.js +++ b/lib/shared/permissions.js @@ -198,6 +198,13 @@ exports.elevateCommand = (command, options) => { // for now, we should make sure we double check if the error messages // have changed every time we upgrade `sudo-prompt`. + }).catch((error) => { + return _.includes(error.message, 'is not in the sudoers file'); + }, () => { + throw errors.createUserError({ + title: 'Your user doesn\'t have enough privileges to proceed', + description: 'This application requires sudo privileges to be able to write to drives' + }); }).catch({ message: 'User did not grant permission.' }, () => {