Search in sources :

Example 1 with PortalErrorMapper

use of com.enonic.xp.portal.impl.mapper.PortalErrorMapper in project xp by enonic.

the class ErrorHandlerScriptImpl method doExecute.

private PortalResponse doExecute(final PortalError portalError, final String handlerMethod) {
    Tracer.withCurrent(this::addTraceInfo);
    final PortalErrorMapper portalErrorMapper = new PortalErrorMapper(portalError);
    final ScriptValue result = this.scriptExports.executeMethod(handlerMethod, portalErrorMapper);
    if ((result == null) || !result.isObject()) {
        return null;
    } else {
        return new PortalResponseSerializer(result, portalError.getStatus()).defaultPostProcess(false).applyFilters(false).serialize();
    }
}
Also used : ScriptValue(com.enonic.xp.script.ScriptValue) PortalResponseSerializer(com.enonic.xp.portal.impl.controller.PortalResponseSerializer) PortalErrorMapper(com.enonic.xp.portal.impl.mapper.PortalErrorMapper)

Aggregations

PortalResponseSerializer (com.enonic.xp.portal.impl.controller.PortalResponseSerializer)1 PortalErrorMapper (com.enonic.xp.portal.impl.mapper.PortalErrorMapper)1 ScriptValue (com.enonic.xp.script.ScriptValue)1