Search in sources :

Example 1 with ErrorCode

use of core.framework.log.ErrorCode in project core-ng-project by neowu.

the class LogManager method logError.

public void logError(Throwable e) {
    String errorMessage = e.getMessage();
    String errorCode = errorCode(e);
    Marker marker = Markers.errorCode(errorCode);
    if (e instanceof ErrorCode && ((ErrorCode) e).severity() == Severity.WARN) {
        logger.warn(marker, errorMessage, e);
    } else {
        logger.error(marker, errorMessage, e);
    }
}
Also used : Marker(org.slf4j.Marker) ErrorCode(core.framework.log.ErrorCode)

Example 2 with ErrorCode

use of core.framework.log.ErrorCode in project core-ng-project by neowu.

the class HTTPServerErrorHandler method errorResponse.

ErrorResponse errorResponse(Throwable e, String actionId) {
    ErrorResponse response = new ErrorResponse();
    response.id = actionId;
    response.message = e.getMessage();
    response.stackTrace = Exceptions.stackTrace(e);
    if (e instanceof ErrorCode) {
        ErrorCode errorCode = (ErrorCode) e;
        response.errorCode = errorCode.errorCode();
        response.severity = errorCode.severity().name();
    } else {
        response.errorCode = "INTERNAL_ERROR";
        response.severity = Severity.ERROR.name();
    }
    return response;
}
Also used : ErrorCode(core.framework.log.ErrorCode) ErrorResponse(core.framework.impl.web.service.ErrorResponse)

Aggregations

ErrorCode (core.framework.log.ErrorCode)2 ErrorResponse (core.framework.impl.web.service.ErrorResponse)1 Marker (org.slf4j.Marker)1