New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception objects (Pull Request Challenge January 2016) #23

Merged
merged 2 commits into from Jan 30, 2017

Conversation

Projects
None yet
3 participants
@omega
Contributor

omega commented Jan 2, 2016

The naming of exceptions is not consistent now, and I am struggling to come up with good names, so if anyone else has ideas for what is best naming policy, that would be great. I was struggling between naming for expected behaviour or naming for what the error is, while trying to keep them short.

The test for Tie::IxHash::Extension throwing an exception object, is that the code that uses it still survives and throws it's exceptions in the correct ways.

I uses Safe::Isa since that is what failures recommends.

The code gets a bit bigger with this, and I am not sure the payload is necessary, but I do think adding the trace is a good idea. I added the payload mostly to show how it's done for later.

This attempts to address the second issue outlined in #20.

omega added some commits Jan 2, 2016

Change an exception to use failures
This adds a test to ensure we have objects of the right class thrown. The code
gets a bit bigger with this, and I am not sure the payload is neccesary, but I do
think adding the trace is a good idea. I added the payload mostly to show how it's
done for later.
Convert rest of exceptions to objects
Went through all `die` and `confess` calls I could find, and converted them to
failure->throw. The naming of exceptions is not consistent now, and I am struggling
to come up with good names, so if anyone else has ideas for what is best naming
policy, that would be great. I was struggling between naming for expected behaviour
or naming for what the error is, while trying to keep them short.

The test for `Tie::IxHash::Extension` throwing an exception object, is that the
code that uses it still survives and throws it's exepctions in the correct ways.

I uses `Safe::Isa` since that is what `failures` recommends.
@neilb

This comment has been minimized.

Show comment
Hide comment
@neilb

neilb Jan 2, 2016

This PR was submitted by a participant in the CPAN Pull Request Challenge

neilb commented Jan 2, 2016

This PR was submitted by a participant in the CPAN Pull Request Challenge

@zmughal

This comment has been minimized.

Show comment
Hide comment
@zmughal

zmughal Jan 30, 2017

Member

Thanks for this! Sorry it took such a long time to get to it.

Member

zmughal commented Jan 30, 2017

Thanks for this! Sorry it took such a long time to get to it.

@zmughal zmughal merged commit 054460b into EntropyOrg:master Jan 30, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment