pcottle/learnGitBranching · info · CommandResult

<dynamic remote listing>

Error message

<dynamic remote listing>

What it means

Not a failure: printRemotes formats the remote listing ('origin', optionally with verbose URL lines) and delivers it via a thrown CommandResult, matching the app's output-as-exception convention.

Source

Thrown at src/js/git/index.js:878

  tags.forEach(function (tag) {
    result += tag.id + '\n';
  });
  throw new CommandResult({
    msg: result
  });
};

GitEngine.prototype.printRemotes = function(options) {
  var result = '';
  if (options.verbose) {
    result += 'origin (fetch)\n';
    result += TAB + 'git@github.com:pcottle/foo.git' + '\n\n';
    result += 'origin (push)\n';
    result += TAB + 'git@github.com:pcottle/foo.git';
  } else {
    result += 'origin';
  }
  throw new CommandResult({
    msg: result
  });
};

GitEngine.prototype.getUniqueID = function() {
  var id = this.uniqueId('C');

  var hasID = function(idToCheck) {
    // loop through and see if we have it locally or
    // remotely
    if (this.refs[idToCheck]) {
      return true;
    }
    if (this.origin && this.origin.refs[idToCheck]) {
      return true;
    }
    return false;
  }.bind(this);

View on GitHub (pinned to 5b09d0ff96)

Solutions

  1. Catch CommandResult and render e.msg
  2. Use the command dispatcher so output is handled for you

Example fix

// before
engine.printRemotes({}); // throws
// after
try { engine.printRemotes({}); }
catch (e) { if (e instanceof CommandResult) display(e.msg); else throw e; }
Defensive patterns

Strategy: try-catch

Type guard

function isCommandResult(e){ return e instanceof CommandResult; }

Try / catch

try { engine.printRemotes(options); } catch (e) { if (e instanceof CommandResult) { show(e.msg); } else { throw e; } }

Prevention

When it happens

Trigger: Running `git remote` or `git remote -v` successfully; direct calls to printRemotes(options).

Common situations: Programmatic use of GitEngine without catching CommandResult; expecting a return value instead of a throw.

Related errors


AI-assisted analysis of pcottle/learnGitBranching@5b09d0ff96 (2026-08-27). Data as JSON: /api/errors/3de9d93fccbe27cf. Report an issue: GitHub.