pcottle/learnGitBranching · info · CommandResult
<dynamic tag listing>
Error message
<dynamic tag listing>
What it means
Not a failure: printTags builds the tag listing (one tag id per line) and returns it by throwing a CommandResult, which the dispatcher renders as normal command output.
Source
Thrown at src/js/git/index.js:863
this.printBranches(toPrint);
};
GitEngine.prototype.printBranches = function(branches) {
var result = '';
branches.forEach(branch => {
result += (branch.selected ? '* ' : '') + this.resolveName(branch.id).split('"')[1] + '\n';
});
throw new CommandResult({
msg: result
});
};
GitEngine.prototype.printTags = function(tags) {
var result = '';
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
});
};View on GitHub (pinned to 5b09d0ff96)
Solutions
- Handle CommandResult in a catch block when calling directly
- Let the standard command pipeline invoke it instead
Example fix
// before
engine.printTags(tags); // throws
// after
try { engine.printTags(tags); }
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.printTags(tags); } catch (e) { if (e instanceof CommandResult) { show(e.msg); } else { throw e; } } Prevention
- Expect output-as-exception from all print* helpers
- Distinguish GitError from CommandResult in catches
When it happens
Trigger: Running `git tag` successfully; any code path that invokes printTags.
Common situations: Only matters for programmatic callers of GitEngine who don't handle the throw-for-output convention.
Related errors
- <dynamic branch listing>
- <dynamic remote listing>
- No tag found, nothing to remove
- bad-tag-name
- Tags are not allowed as sources for pushing
AI-assisted analysis of pcottle/learnGitBranching@5b09d0ff96 (2026-08-27).
Data as JSON: /api/errors/738b36ebe4b28ad9.
Report an issue: GitHub.