Package br.com.caelum.vraptor

Examples of br.com.caelum.vraptor.InterceptionException


            validator.onErrorUse(nothing());
          } catch (ValidationException e) {
            log.debug("Some validation errors occured: {}", e.getErrors());
          }
        }
        throw new InterceptionException(
            "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"
            + "or any view that you like.\n"
            + "If you didn't add any validation error, it is possible that a conversion error had happened.");
      }

      if (reflectionMethod.getReturnType().equals(Void.TYPE)) {
        // vraptor2 compatibility
        this.info.setResult("ok");
      } else {
        this.info.setResult(result);
      }
      stack.next(method, resourceInstance);
    } catch (IllegalArgumentException e) {
      throw new InterceptionException(e);
    } catch (IllegalAccessException e) {
      throw new InterceptionException(e);
    } catch (InvocationTargetException e) {
      Throwable cause = e.getCause();
      if (cause instanceof ValidationException) {
        // fine... already parsed
        log.trace("swallowing {}", cause);
      } else {
        throw new InterceptionException("exception raised, check root cause for details: " + cause, cause);
      }
    }
  }
View Full Code Here


    boolean hasAroundMethod = hasAnnotatedMethod(AroundCall.class, originalType, methods);
    boolean hasBeforeMethod = hasAnnotatedMethod(BeforeCall.class, originalType, methods);

    if (!hasAfterMethod && !hasAroundMethod && !hasBeforeMethod) {

      throw new InterceptionException(format("Interceptor %s must "
        + "declare at least one method whith @AfterCall, @AroundCall "
        + "or @BeforeCall annotation", originalType.getCanonicalName()));
    }
  }
View Full Code Here

    Method accepts = invoker.findMethod(methods, Accepts.class, originalType);

    if (accepts != null && !accepts.getReturnType().equals(Boolean.class)
        && !accepts.getReturnType().equals(boolean.class)) {
      throw new InterceptionException(format("@%s method must return "
        + "  boolean", Accepts.class.getSimpleName()));
    }
  }
View Full Code Here

      return new Mirror().on(interceptor).invoke().method(stepMethod).withArgs(params);
    } catch (Exception e) {
      // we dont wanna wrap it if it is a simple controller business logic
      // exception
      Throwables.propagateIfInstanceOf(e.getCause(), ApplicationLogicException.class);
      throw new InterceptionException(e.getCause());
    }
  }
View Full Code Here

TOP

Related Classes of br.com.caelum.vraptor.InterceptionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.