Skip to content

Commit

Permalink
removing wrap and throwing ValidationFailedException instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Turini committed Feb 21, 2015
1 parent dd953c4 commit c41f284
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package br.com.caelum.vraptor.observer;

import br.com.caelum.vraptor.InterceptionException;
import static org.slf4j.LoggerFactory.getLogger;

import org.slf4j.Logger;

import br.com.caelum.vraptor.core.ReflectionProviderException;
import br.com.caelum.vraptor.interceptor.ApplicationLogicException;
import br.com.caelum.vraptor.validator.ValidationException;

import org.slf4j.Logger;

import com.google.common.base.Throwables;

import static org.slf4j.LoggerFactory.getLogger;

/**
* Handles exceptions thrown by a controller method
*
Expand All @@ -20,10 +19,6 @@ public class ExecuteMethodExceptionHandler {
private final static Logger log = getLogger(ExecuteMethodExceptionHandler.class);

public void handle(Exception exception) {
if (exception instanceof IllegalArgumentException
|| exception instanceof IllegalStateException) {
throw new InterceptionException(exception);
}
if (exception instanceof ReflectionProviderException) {
throwIfNotValidationException(exception, exception.getCause());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void assertAbsenceOfErrors() {
if (hasUnhandledErrors()) {
log.debug("Some validation errors occured: {}", getErrors());

throw new IllegalStateException(
throw new ValidationFailedException(
"There are validation errors and you forgot to specify where to go. Please add in your method "
+ "something like:\n"
+ "validator.onErrorUse(page()).of(AnyController.class).anyMethod();\n"
Expand Down

0 comments on commit c41f284

Please sign in to comment.