Search in sources :

Example 6 with ApplicationException

use of org.sklsft.commons.api.exception.ApplicationException in project skeleton-commons by skeleton-software-community.

the class AjaxMethodAspect method execute.

@Around("ajaxMethods()")
public void execute(ProceedingJoinPoint joinPoint) throws Throwable {
    Method proxiedMethod = ((MethodSignature) joinPoint.getSignature()).getMethod();
    AjaxMethod ajaxMethod = proxiedMethod.getAnnotation(AjaxMethod.class);
    String value = ajaxMethod.value();
    try {
        logger.info(value);
        joinPoint.proceed();
        messageHandler.displayInfo(value + ".success");
        logger.info("completed");
    } catch (ApplicationException e) {
        messageHandler.displayError(e.getMessage());
        logger.error("failed : " + e.getClass().getSimpleName() + " - " + e.getMessage(), e);
    } catch (Exception e) {
        messageHandler.displayError(value + ".failure");
        logger.error("failed : " + e.getClass().getSimpleName() + " - " + e.getMessage(), e);
    }
}
Also used : ApplicationException(org.sklsft.commons.api.exception.ApplicationException) MethodSignature(org.aspectj.lang.reflect.MethodSignature) AjaxMethod(org.sklsft.commons.mvc.annotations.AjaxMethod) AjaxMethod(org.sklsft.commons.mvc.annotations.AjaxMethod) Method(java.lang.reflect.Method) ApplicationException(org.sklsft.commons.api.exception.ApplicationException) Around(org.aspectj.lang.annotation.Around)

Aggregations

ApplicationException (org.sklsft.commons.api.exception.ApplicationException)6 Test (org.junit.Test)4 ErrorReport (org.sklsft.commons.api.exception.ErrorReport)4 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 Around (org.aspectj.lang.annotation.Around)1 MethodSignature (org.aspectj.lang.reflect.MethodSignature)1 TechnicalError (org.sklsft.commons.api.exception.TechnicalError)1 AjaxMethod (org.sklsft.commons.mvc.annotations.AjaxMethod)1