-
Notifications
You must be signed in to change notification settings - Fork 699
Closed
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 common ancestor.
[Error: No merge base found]
The 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...
catch(function(err, code) {
console.log(err);
console.log(code);
});catch(function(err) {
console.log(err.msg);
console.log(err.code);
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels