Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Net-API-RPX CPAN distribution.

Report information
The Basics
Id: 45141
Status: resolved
Priority: 0/
Queue: Net-API-RPX

People
Owner: KENTNL [...] cpan.org
Requestors: ABH [...] cpan.org
Cc: KENTNL [...] cpan.org
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.01
Fixed in: 0.04



Subject: Dies on API errros
The module dies when there are any errors, which I suppose is fine. What's not fine is that not being mentioned in the documentation!
Also: it really should die with a newline at the end of the message so the (useless) Net::API::RPX line number doesn't pass through.
Stephan Jauernick has been incredibly helpful and has helped get Catalyst::Authentication::RPX into a mostly working state, apart from these dies. And this is /mostly/ in the case of users doing silly things like hitting the back button after logging in and replaying the authentication request. But at present, a 'die' is not very helpful at propagating this error up to where it can be handled intelligently, apart from a bit of regex, and thats hardly reliable. So, instead, I propose the use of exceptions, and to make things easier, I've done all the hard work of sorting out exceptions and making sure they work, with a bit of voodoo from Exception::Class and MooseX::NonMoose. The code to make this happen is available in my github fork's Exceptional branch: http://github.com/kentfredric/net-api-rpx/tree/Exceptional It has oodles of tests, and dies with exception objects containing more than I can imagine anyone ever finding a need for, so they can introspect the failure case and DoTheRightThing for userland, ( be it silently keeping on trucking if the users just being dense, or telling the user where to go ). You can probably use TryCatch or Try::Tiny in conjunction with this module and get lovely exception stuff, but for sake of brevity, my tests just use a closure+eval+assign $@ to a variable. I do hope this is found to be useful, and I would like feedback from other requesters as to their thoughts. I've actually gone a step further and replaced all 'die' calls with exceptions that make sense, so it produces a smarter error to the recipient as to what they need to do to solve the error, and, additionally, if one sets $ENV{NET_API_RPX_STACKTRACE}=1 All exceptions that are unhanded will print a lovely stack-trace too =). All the best. Hope this is helpful. -- KENTNL.
If you want a good diff of the changes: http://github.com/kentfredric/net-api-rpx/compare/master...Exceptional Is a good overview. But not much has been left untouched =)
@ABH: I've cut a new release of Net::API::RPX : https://metacpan.org/release/Net-API-RPX Its got exceptions and hopefully very very extensive error reporting via throwing instances of Throwable based classes, including backtraces and stuff like that. I'm going to mark this as patched, and I hope you can get back to me and explain how it works out for you so this can be marked closed. Thanks =)
Marking as resolved as lack of feedback + Moving issues to github.