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);
}
}
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;
}
Aggregations