You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In issue #54, @larryl gave us a way for subclasses to change the default behavior of run-time errors. In that issue, @schwern asked:
Perhaps it can be extended to cover other error messages we have?
We only have three calls to die in the module (not counting the one in Method::Signatures::Modifiers, which I think is a separate issue):
run-time errors
compile-time errors
pre-existing errors at parse time, which we rethrow
So, 1) is handled by #54. 3) we should probably not pass to our subclasses (given that it doesn't come from us). So that just leaves 2).
Compile-time errors are handled by sig_parsing_error in Method::Signatures::Parser. We could just change that die to a call to signature_error_handler and call it a day. However, there are three considerations that I'd like to clear up first.
It means passing $class down into some places where it currently isn't. Probably not a big deal, but a bit of extra work.
Just because we could doesn't mean we should. Should we, in fact, allow subclasses to grab compile-time (i.e. signature parsing) errors?
Assuming we should, should we then modify signature_error_handler to be able to distinguish run-time from compile-time errors? I can imagine a subclass wanting to handle those differently.
I'm going to go ahead and get the fix for #54 live, so this is not a gating factor or anything. But I'd like some further discussion before proceeding with adding compile-time errors to this.
The text was updated successfully, but these errors were encountered:
In issue #54, @larryl gave us a way for subclasses to change the default behavior of run-time errors. In that issue, @schwern asked:
We only have three calls to
die
in the module (not counting the one in Method::Signatures::Modifiers, which I think is a separate issue):So, 1) is handled by #54. 3) we should probably not pass to our subclasses (given that it doesn't come from us). So that just leaves 2).
Compile-time errors are handled by
sig_parsing_error
in Method::Signatures::Parser. We could just change thatdie
to a call tosignature_error_handler
and call it a day. However, there are three considerations that I'd like to clear up first.$class
down into some places where it currently isn't. Probably not a big deal, but a bit of extra work.signature_error_handler
to be able to distinguish run-time from compile-time errors? I can imagine a subclass wanting to handle those differently.I'm going to go ahead and get the fix for #54 live, so this is not a gating factor or anything. But I'd like some further discussion before proceeding with adding compile-time errors to this.
The text was updated successfully, but these errors were encountered: