{"record":{"id":"3de9d93fccbe27cf","repo":"pcottle/learnGitBranching","slug":"dynamic-remote-listing","errorCode":null,"errorMessage":"<dynamic remote listing>","messagePattern":"<dynamic remote listing>","errorType":"validation","errorClass":"CommandResult","httpStatus":null,"severity":"info","filePath":"src/js/git/index.js","lineNumber":878,"sourceCode":"  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};\n\nGitEngine.prototype.getUniqueID = function() {\n  var id = this.uniqueId('C');\n\n  var hasID = function(idToCheck) {\n    // loop through and see if we have it locally or\n    // remotely\n    if (this.refs[idToCheck]) {\n      return true;\n    }\n    if (this.origin && this.origin.refs[idToCheck]) {\n      return true;\n    }\n    return false;\n  }.bind(this);","sourceCodeStart":860,"sourceCodeEnd":896,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/git/index.js#L860-L896","documentation":"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.","triggerScenarios":"Running `git remote` or `git remote -v` successfully; direct calls to printRemotes(options).","commonSituations":"Programmatic use of GitEngine without catching CommandResult; expecting a return value instead of a throw.","solutions":["Catch CommandResult and render e.msg","Use the command dispatcher so output is handled for you"],"exampleFix":"// before\nengine.printRemotes({}); // throws\n// after\ntry { engine.printRemotes({}); }\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.printRemotes(options); } catch (e) { if (e instanceof CommandResult) { show(e.msg); } else { throw e; } }","preventionTips":["Treat CommandResult throws as success paths","Route listing commands through the dispatcher"],"tags":["git","remote","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"}