Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion 9 generate/templates/manual/patches/convenient_patches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,15 @@ void GitPatch::ConvenientFromDiffWorker::HandleOKCallback() {
}

if (baton->error) {
Local<v8::Object> err;
if (baton->error->message) {
err = Nan::Error(baton->error->message)->ToObject();
} else {
err = Nan::Error("Method convenientFromDiff has thrown an error.")->ToObject();
}
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
err
};
callback->Call(1, argv);
if (baton->error->message)
Expand Down
9 changes: 8 additions & 1 deletion 9 generate/templates/manual/revwalk/fast_walk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,15 @@ void GitRevwalk::FastWalkWorker::HandleOKCallback()
{
if (baton->error)
{
Local<v8::Object> err;
if (baton->error->message) {
err = Nan::Error(baton->error->message)->ToObject();
} else {
err = Nan::Error("Method fastWalk has thrown an error.")->ToObject();
}
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
err
};
callback->Call(1, argv);
if (baton->error->message)
Expand Down
9 changes: 8 additions & 1 deletion 9 generate/templates/manual/revwalk/file_history_walk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,15 @@ void GitRevwalk::FileHistoryWalkWorker::HandleOKCallback()
}

if (baton->error) {
Local<v8::Object> err;
if (baton->error->message) {
err = Nan::Error(baton->error->message)->ToObject();
} else {
err = Nan::Error("Method fileHistoryWalk has thrown an error.")->ToObject();
}
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
err
};
callback->Call(1, argv);
if (baton->error->message)
Expand Down
9 changes: 8 additions & 1 deletion 9 generate/templates/partials/async_function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,15 @@ void {{ cppClassName }}::{{ cppFunctionName }}Worker::HandleOKCallback() {
callback->Call(2, argv);
} else {
if (baton->error) {
v8::Local<v8::Object> err;
if (baton->error->message) {
err = Nan::Error(baton->error->message)->ToObject();
} else {
err = Nan::Error("Method {{ jsFunctionName }} has thrown an error.")->ToObject();
}
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
v8::Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
err
};
callback->Call(1, argv);
if (baton->error->message)
Expand Down
22 changes: 22 additions & 0 deletions 22 test/tests/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -1298,4 +1298,26 @@ describe("Merge", function() {
assert.ok(repository.isDefaultState());
});
});

it("can retrieve error code on if common merge base not found", function() {
var repo;
return NodeGit.Repository.open(local("../repos/workdir"))
.then(function(r) {
repo = r;
return repo.getCommit("4bd806114ce26503c103c85dcc985021951bbc18");
})
.then(function(commit) {
return commit.getParents(commit.parentcount());
})
.then(function(parents) {
return NodeGit.Merge.base(repo, parents[0], parents[1])
.then(function() {
return Promise.reject(new Error(
"should not be able to retrieve common merge base"));
}, function(err) {
assert.equal("no merge base found", err.message);
assert.equal(NodeGit.Error.CODE.ENOTFOUND, err.errno);
});
});
});
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.