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

propagating alternative cause if it's not checked #945

Merged
merged 6 commits into from
Feb 25, 2015
Merged

propagating alternative cause if it's not checked #945

merged 6 commits into from
Feb 25, 2015

Conversation

Turini
Copy link
Member

@Turini Turini commented Feb 17, 2015

As suggested by @lucascs here. Closes #911.

It breaks compatibility, but we're going to 4.2 and it'll be very highlighted
on release notes. I'll add some docs before merging it. What do you think?

@@ -17,7 +20,8 @@
private final static Logger log = getLogger(ExecuteMethodExceptionHandler.class);

public void handle(Exception exception) {
if (exception instanceof IllegalArgumentException) {
if (exception instanceof IllegalArgumentException
|| exception instanceof IllegalStateException) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm almost tending to use VRaptor specific exceptions for this case, instead of reusing IllegalArg and IllegalState...

We're doing this only because of validations, right?
We could create a ValidationFailedException.

@nykolaslima
Copy link
Contributor

Look good to me. I just didn't understand why we are wrapping IllegalArgumentException and IllegalStateException. Can you help me to understand it?

@Turini
Copy link
Member Author

Turini commented Feb 20, 2015

about the IllegalStateException, that's because VRaptor throws it when user
didn't specify what to do when an validation error happens. In that case makes
sense for me throw ValidationFailedException instead, as @lucascs just said.

@Turini
Copy link
Member Author

Turini commented Feb 20, 2015

guys, telling the truth, I've no idea why we wrap the IllegalArgumentException
as InterceptorException. Looking our code it doesn't make sense for me now.

does anyone know why we're doint it? (and looking here, VRaptor 3 wrap it too)

@nykolaslima
Copy link
Contributor

If there is no reason, can't we just create the new exception as you guys suggested?

@Turini
Copy link
Member Author

Turini commented Feb 20, 2015

yes, if truly there is no reason (I guess, not sure), we can refactor it removing
the if and using the new validation error exception proposed. I'd be nice,
but lets wait a while to see if anyone knows the reason, before refactoring it :)

@nykolaslima
Copy link
Contributor

👍

@lucascs
Copy link
Member

lucascs commented Feb 20, 2015

I don't remember the reason, but I see no harm in doing it.

I just looked at the file history on VRaptor 3, and these catches went back to early 2009, first versions of VRaptor.

Remove it, and we let people test it and see if some bugs appear, but I don't see why it would happen.

@Turini
Copy link
Member Author

Turini commented Feb 20, 2015

:happy_panda:

@Turini
Copy link
Member Author

Turini commented Feb 23, 2015

I've updated my PR. What do you think?

@nykolaslima
Copy link
Contributor

👍

@lucascs
Copy link
Member

lucascs commented Feb 24, 2015

🚢

@Turini Turini added this to the 4.2.0.Final milestone Feb 25, 2015
Turini added a commit that referenced this pull request Feb 25, 2015
propagating alternative cause if it's not checked
@Turini Turini merged commit 695c1f4 into master Feb 25, 2015
@Turini Turini deleted the issue_911 branch February 25, 2015 14:16
@nykolaslima
Copy link
Contributor

😍

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

Successfully merging this pull request may close these issues.

Can't catch specific exception in Interceptor
3 participants