public static Errors.SerializedException convertException(Throwable t) { Errors.SerializedException.Builder builder = Errors.SerializedException.newBuilder(); if (ExceptionUtil.isExceptionWithResultCode(t)) { DefaultTajoException tajoException = (DefaultTajoException) t; builder.setReturnCode(tajoException.getErrorCode()); builder.setMessage(tajoException.getMessage()); } else { Throwable rootCause = ExceptionUtils.getRootCause(t); if(rootCause != null) t = rootCause; builder.setReturnCode(ResultCode.INTERNAL_ERROR); builder.setMessage(ErrorMessages.getInternalErrorMessage(t)); } builder.setStackTrace(ErrorUtil.convertStacktrace(t)); builder.setTimestamp(System.currentTimeMillis()); return builder.build(); } }
public static Errors.SerializedException convertException(Throwable t) { Errors.SerializedException.Builder builder = Errors.SerializedException.newBuilder(); if (ExceptionUtil.isExceptionWithResultCode(t)) { DefaultTajoException tajoException = (DefaultTajoException) t; builder.setReturnCode(tajoException.getErrorCode()); builder.setMessage(tajoException.getMessage()); } else { Throwable rootCause = ExceptionUtils.getRootCause(t); if(rootCause != null) t = rootCause; builder.setReturnCode(ResultCode.INTERNAL_ERROR); builder.setMessage(ErrorMessages.getInternalErrorMessage(t)); } builder.setStackTrace(ErrorUtil.convertStacktrace(t)); builder.setTimestamp(System.currentTimeMillis()); return builder.build(); } }
public static ReturnState returnError(Throwable t) { ReturnState.Builder builder = ReturnState.newBuilder(); if (ExceptionUtil.isExceptionWithResultCode(t)) { DefaultTajoException tajoException = (DefaultTajoException) t; builder.setReturnCode(tajoException.getErrorCode()); builder.setMessage(tajoException.getMessage()); } else { builder.setReturnCode(ResultCode.INTERNAL_ERROR); builder.setMessage(ErrorMessages.getInternalErrorMessage(t)); } builder.setStackTrace(ErrorUtil.convertStacktrace(t)); return builder.build(); }
public static ReturnState returnError(Throwable t) { ReturnState.Builder builder = ReturnState.newBuilder(); if (ExceptionUtil.isExceptionWithResultCode(t)) { DefaultTajoException tajoException = (DefaultTajoException) t; builder.setReturnCode(tajoException.getErrorCode()); builder.setMessage(tajoException.getMessage()); } else { builder.setReturnCode(ResultCode.INTERNAL_ERROR); builder.setMessage(ErrorMessages.getInternalErrorMessage(t)); } builder.setStackTrace(ErrorUtil.convertStacktrace(t)); return builder.build(); }