Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Error constants added #25

Closed
wants to merge 2 commits into from

3 participants

@milani

Fixes #23

Standard libgit2 error constants attached to Error object.

An outdated example fixed.

@tbranyen

Whats the reason for this change here? Did the existing implementation not work as expected?

Both lines does not work! I should send another pull request. it should be:

master.lookup( repo , .....);

lookupRef does exists and also repo.lookup needs an extra argument.

Owner

Okay lets try and figure this out before I merge this request. I don't think another pull req is necessary. Lets just add commits to this branch.

Sorry But I pushed another commit to fix this example.

@tbranyen
Owner

@milani thats fine that commit showed up in this pull as well.

@faceleg

Excuse me for asking a likely obvious question - this will make the actual error available on the error object like (?):

console.log(error.strError);

Yes.

@faceleg

Thanks for this!

Would you please update the tests to include some that cover these changes? Then we can look at merging this in.

@faceleg faceleg referenced this pull request
Closed

Issue with errors #23

@milani

Sorry but this is for a year ago. I can not remember the details:)

@milani milani closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 30, 2011
  1. @milani
  2. @milani

    Example fixed

    milani authored
This page is out of date. Refresh to see the latest.
Showing with 25 additions and 1 deletion.
  1. +1 −1  example/raw-repo.js
  2. +24 −0 src/error.cc
View
2  example/raw-repo.js
@@ -8,7 +8,7 @@ var repo = new git.Repo(),
// Access existing repository
repo.open( path.resolve( '../.git' ), function( err ) {
var master = new git.Ref(repo);
- repo.lookupRef( master, 'refs/heads/master', function( err, ref ) {
+ master.lookup( repo, 'refs/heads/master', function( err, ref ) {
console.log(err, master);
var oid = new git.Oid();
master.oid(oid);
View
24 src/error.cc
@@ -24,6 +24,30 @@ void GitError::Initialize (Handle<v8::Object> target) {
constructor_template->SetClassName(String::NewSymbol("Error"));
NODE_SET_PROTOTYPE_METHOD(constructor_template, "strError", StrError);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_SUCCESS);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_ERROR);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_ENOTOID);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_ENOTFOUND);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_ENOMEM);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EOSERR);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EOBJTYPE);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EOBJCORRUPTED);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_ENOTAREPO);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EINVALIDTYPE);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EMISSINGOBJDATA);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EPACKCORRUPTED);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EFLOCKFAIL);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EZLIB);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EBUSY);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EBAREINDEX);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EINVALIDREFNAME);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EREFCORRUPTED);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_ETOONESTEDSYMREF);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EPACKEDREFSCORRUPTED);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EINVALIDPATH);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EREVWALKOVER);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_EINVALIDREFSTATE);
+ NODE_DEFINE_CONSTANT(constructor_template, GIT_ENOTIMPLEMENTED);
target->Set(String::NewSymbol("Error"), constructor_template->GetFunction());
}
Something went wrong with that request. Please try again.