Skip to content
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

Extend signature error handling to compile-time errors #63

Open
barefootcoder opened this issue Feb 17, 2013 · 0 comments
Open

Extend signature error handling to compile-time errors #63

barefootcoder opened this issue Feb 17, 2013 · 0 comments

Comments

@barefootcoder
Copy link
Contributor

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):

  1. run-time errors
  2. compile-time errors
  3. 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.

barefootcoder added a commit that referenced this issue Feb 17, 2013
I don't know if it will need to use signature_error_handler, but JIC it does, it should be easy now
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

No branches or pull requests

1 participant