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 <jv@jviotti.com>
This commit is contained in:
Juan Cruz Viotti 2017-08-01 17:35:45 -04:00 committed by GitHub
parent 70ad86534d
commit 861b8a4450

View File

@ -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.'
}, () => {