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.