Skip to content

Throw NotFound and CannotDereference Exceptions - Reborn#842

Merged
nulltoken merged 4 commits intovNextfrom
jamill/error_update
Jan 21, 2015
Merged

Throw NotFound and CannotDereference Exceptions - Reborn#842
nulltoken merged 4 commits intovNextfrom
jamill/error_update

Conversation

@nulltoken
Copy link
Member

This change is to throw more specific exceptions in several cases when
possible. If an object cannot be found, throw a more specific
NotFoundException. If an object exists but cannot be dereferenced to its
desired type, then throw a CannotDereferenceException.

This is the rebirth of #839 that has been too hastily merged (then reverted). 😊

@nulltoken nulltoken mentioned this pull request Oct 8, 2014
@nulltoken
Copy link
Member Author

Depends on libgit2/libgit2#2627

@nulltoken
Copy link
Member Author

Now that libgit2/libgit2#2718 has been merged, we should be able to more easily distinguish root cause of peeling issues.

@Therzok
Copy link
Member

Therzok commented Dec 8, 2014

Does this need to go on top of #870 ?

@nulltoken nulltoken added this to the v0.21 milestone Dec 22, 2014
@jamill
Copy link
Member

jamill commented Dec 27, 2014

Looking more closely at this - I don't think the second commit (a75c2c2e) is needed anymore. What we probably need to do instead is update the documentation around InvalidSpecificationException to properly reflect the current meaning of the underlying libgit2 error and the corresponding libgit2sharp exception (either as part of this PR or separately).

@nulltoken nulltoken force-pushed the jamill/error_update branch from a75c2ce to 7b10d60 Compare January 6, 2015 21:07
@nulltoken
Copy link
Member Author

@jamill I hear you and I agree, however I'm a bit "dry" when it comes to enhancing the exception xml doc. Any idea?

FWIW, I've added some code coverage regarding the lookup of wrong revparse expression. Does it feel ok?

@nulltoken nulltoken force-pushed the jamill/error_update branch from 7b10d60 to 2a72135 Compare January 6, 2015 21:29
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still feel a little bothered that those two above throw different exceptions.

FWIW:

  • master^{commit}^{blob} throws InvalidSpecificationException
  • tags/e90810b^{commit}^{blob} throws InvalidSpecificationException

/cc @carlosmn @jamill Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me. If an app cares about the difference between the errors, it can tell the user what went wrong more specifically.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if the ability to discern between these two cases is actually worth the complexity of having two exceptions that are pretty similar (they both mean I can peel the object as requested). However, everything is working as designed in libgit2 - I wouldn't argue to change the current design unless we get feedback that this is confusing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fits me

@jamill
Copy link
Member

jamill commented Jan 20, 2015

@jamill I hear you and I agree, however I'm a bit "dry" when it comes to enhancing the exception xml doc. Any idea?

I can take a pass at updating the xml docs in a bit. I will tack it on the end of this PR.

@nulltoken
Copy link
Member Author

I can take a pass at updating the xml docs in a bit. I will tack it on the end of this PR.

@jamill ❤️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@nulltoken
Copy link
Member Author

Does anyone oppose to see this merged?

@Therzok
Copy link
Member

Therzok commented Jan 20, 2015

I hereby grant you permission to break API!

jamill and others added 4 commits January 21, 2015 12:20
This change is to throw more specific exceptions in several cases when
possible. If an object cannot be found, throw a more specific
NotFoundException.
Update documentation on InvalidSpecificationException to better reflect
the current meaning of this exception.
@nulltoken nulltoken force-pushed the jamill/error_update branch from 30485a4 to 24446f5 Compare January 21, 2015 11:20
@nulltoken
Copy link
Member Author

Let's do this, then 💥

nulltoken added a commit that referenced this pull request Jan 21, 2015
Throw NotFound and CannotDereference Exceptions - Reborn
@nulltoken nulltoken merged commit 05e81e7 into vNext Jan 21, 2015
@nulltoken nulltoken deleted the jamill/error_update branch January 21, 2015 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments