• Remy Suen's avatar
    Expose libgit2 error code to clients when a promise fails · 8f911102
    Remy Suen authored
    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.
    8f911102
file_history_walk.cc 9.99 KB