Expose libgit2 error code to clients when a promise fails#1209
Merged
johnhaley81 merged 3 commits intonodegit:masternodegit/nodegit:masterfrom Feb 28, 2017
Merged
Expose libgit2 error code to clients when a promise fails#1209johnhaley81 merged 3 commits intonodegit:masternodegit/nodegit:masterfrom
johnhaley81 merged 3 commits intonodegit:masternodegit/nodegit:masterfrom
Conversation
When an API function of libgit2 fails within a promise, the promise is rejected with a JavaScript Error object that wraps the recorded error message in giterr_last(). However, the original non-zero return code of the API function is not exposed to the caller of the NodeGit API. This means that NodeGit clients cannot easily identify what the cause of an error is outside of parsing the Error object's message. This is an extremely volatile way of determining the cause as libgit2 may choose to alter the wording of the message at any time. To solve the problem above, the returned JavaScript Error object now esposes the libgit2 error code via its `errno` property.
johnhaley81
requested changes
Feb 26, 2017
Collaborator
johnhaley81
left a comment
There was a problem hiding this comment.
Just conflicts that need to be resolved then this is GTG.
Merge in the latest changes and resolved a conflict by explicitly referencing the v8 namespace when using Local types.
johnhaley81
approved these changes
Feb 26, 2017
libgit2 has changed all their error messages to start with a lowercased character. Updated the test to reflect this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes up the C++ templates so that libgit2's error code is exposed on the JavaScript side by analyzing the rejected promise.