Skip to content

Missing user.githubuser causes 'Uncaught, unspecified "error" event' #1

Description

@rexwhite

First of all: nice work!

Second, if the user hasn't previously saved their github user id then your generator throws 'Uncaught, unspecified "error" event.' This happens because getUsername() in src/generators/shared/shell.es6 rejects its promise if "git config --get user.githubuser" returns non-zero, which it will if user.githubuser has never been saved.

I suggest just returning "resolve('')" instead.

diff --git a/generators/shared/shell.js b/generators/shared/shell.js
index 2eb601d..25aca7c 100644
--- a/generators/shared/shell.js
+++ b/generators/shared/shell.js
@@ -26,7 +26,7 @@ function getUsername() {
 
     _shelljs2.default.exec('git config --get user.githubuser', { silent: true }, (code, stdout, stderr) => {
       if (code !== 0) {
-        return reject(stderr);
+        return resolve('');
       }
       return resolve(stdout.trim());
     });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions