{"record":{"id":"738b36ebe4b28ad9","repo":"pcottle/learnGitBranching","slug":"dynamic-tag-listing","errorCode":null,"errorMessage":"<dynamic tag listing>","messagePattern":"<dynamic tag listing>","errorType":"validation","errorClass":"CommandResult","httpStatus":null,"severity":"info","filePath":"src/js/git/index.js","lineNumber":863,"sourceCode":"  this.printBranches(toPrint);\n};\n\nGitEngine.prototype.printBranches = function(branches) {\n  var result = '';\n  branches.forEach(branch => {\n    result += (branch.selected ? '* ' : '') + this.resolveName(branch.id).split('\"')[1] + '\\n';\n  });\n  throw new CommandResult({\n    msg: result\n  });\n};\n\nGitEngine.prototype.printTags = function(tags) {\n  var result = '';\n  tags.forEach(function (tag) {\n    result += tag.id + '\\n';\n  });\n  throw new CommandResult({\n    msg: result\n  });\n};\n\nGitEngine.prototype.printRemotes = function(options) {\n  var result = '';\n  if (options.verbose) {\n    result += 'origin (fetch)\\n';\n    result += TAB + 'git@github.com:pcottle/foo.git' + '\\n\\n';\n    result += 'origin (push)\\n';\n    result += TAB + 'git@github.com:pcottle/foo.git';\n  } else {\n    result += 'origin';\n  }\n  throw new CommandResult({\n    msg: result\n  });\n};","sourceCodeStart":845,"sourceCodeEnd":881,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/git/index.js#L845-L881","documentation":"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.","triggerScenarios":"Running `git tag` successfully; any code path that invokes printTags.","commonSituations":"Only matters for programmatic callers of GitEngine who don't handle the throw-for-output convention.","solutions":["Handle CommandResult in a catch block when calling directly","Let the standard command pipeline invoke it instead"],"exampleFix":"// before\nengine.printTags(tags); // throws\n// after\ntry { engine.printTags(tags); }\ncatch (e) { if (e instanceof CommandResult) display(e.msg); else throw e; }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isCommandResult(e){ return e instanceof CommandResult; }","tryCatchPattern":"try { engine.printTags(tags); } catch (e) { if (e instanceof CommandResult) { show(e.msg); } else { throw e; } }","preventionTips":["Expect output-as-exception from all print* helpers","Distinguish GitError from CommandResult in catches"],"tags":["git","tag","command-output","control-flow"],"backgroundTag":"result-as-exception-pattern","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}