Title: Provide error code when a function call has failed · Issue #1206 · nodegit/nodegit · GitHub
Open Graph Title: Provide error code when a function call has failed · Issue #1206 · nodegit/nodegit
X Title: Provide error code when a function call has failed · Issue #1206 · nodegit/nodegit
Description: return git.Merge.base(repo, parents[0], parents[1]); .then(function(ancestor) { console.log(ancestor); }) .catch(function(err) { console.log(err); }) Running the code above will print out the output below if the two commits have no commo...
Open Graph Description: return git.Merge.base(repo, parents[0], parents[1]); .then(function(ancestor) { console.log(ancestor); }) .catch(function(err) { console.log(err); }) Running the code above will print out the outpu...
X Description: return git.Merge.base(repo, parents[0], parents[1]); .then(function(ancestor) { console.log(ancestor); }) .catch(function(err) { console.log(err); }) Running the code above will print out the outpu...
Opengraph URL: https://github.com/nodegit/nodegit/issues/1206
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Provide error code when a function call has failed","articleBody":"```JavaScript\r\nreturn git.Merge.base(repo, parents[0], parents[1]);\r\n.then(function(ancestor) {\r\n console.log(ancestor);\r\n})\r\n.catch(function(err) {\r\n console.log(err);\r\n})\r\n```\r\nRunning the code above will print out the output below if the two commits have no common ancestor.\r\n\r\n```[Error: No merge base found]```\r\n\r\nThe error code behind this error is `Error.CODE.ENOTFOUND` but there is no way for a client to know this. Not having a common ancestor between two commits is an error that a client may be able to handle gracefully but if it the function failed because of some other fatal error then maybe the client can't do anything about it. Without an error code available in the `catch` callback, clients have no way of figuring out why the function failed outside of parsing the error message itself. It would be nice if we could have something like either of the two following patterns...\r\n\r\n```JavaScript\r\ncatch(function(err, code) {\r\n console.log(err);\r\n console.log(code);\r\n});\r\n```\r\n```JavaScript\r\ncatch(function(err) {\r\n console.log(err.msg);\r\n console.log(err.code);\r\n});\r\n```","author":{"url":"https://github.com/rcjsuen","@type":"Person","name":"rcjsuen"},"datePublished":"2017-01-29T04:53:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/1206/nodegit/issues/1206"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fdbeb6ce-6367-6296-4b86-bc5a268ad83e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A426:36D84E:25350F6:3431B13:6A5F5DFB |
| html-safe-nonce | d0a7ddea40212e53a235ac0ce61d8b2131e1e72b78634947fc6dc815d109fdcf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDI2OjM2RDg0RToyNTM1MEY2OjM0MzFCMTM6NkE1RjVERkIiLCJ2aXNpdG9yX2lkIjoiNjE4OTUyOTc0NDg4MTQ0MjI5OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | eee975e8d0a74e252cca7e7c48c37417535e5632b251b17d3303b28dff7ddc3f |
| hovercard-subject-tag | issue:203850517 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodegit/nodegit/1206/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b33beb41d4d01def81f8e628caf963c0f216880c35bdbd28e3d9a5e22e474eaf/nodegit/nodegit/issues/1206 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b33beb41d4d01def81f8e628caf963c0f216880c35bdbd28e3d9a5e22e474eaf/nodegit/nodegit/issues/1206 |
| og:image:alt | return git.Merge.base(repo, parents[0], parents[1]); .then(function(ancestor) { console.log(ancestor); }) .catch(function(err) { console.log(err); }) Running the code above will print out the outpu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rcjsuen |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9a0797c11799dbfd7df57fa3de31c7ea3a4c4bd055eb1a0427a5cde1d4d7ba3f |
| turbo-cache-control | no-preview |
| go-import | github.com/nodegit/nodegit git https://github.com/nodegit/nodegit.git |
| octolytics-dimension-user_id | 657068 |
| octolytics-dimension-user_login | nodegit |
| octolytics-dimension-repository_id | 1383170 |
| octolytics-dimension-repository_nwo | nodegit/nodegit |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1383170 |
| octolytics-dimension-repository_network_root_nwo | nodegit/nodegit |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b099d96da147aea31036cd16b2fba0083a6defe4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width