/** * Builds the error message string. The error type message is appended with the extra message. If appendCause * is true for the error type, then the message of the cause also is added to the message. * @param type the error type * @param extraMessage the extra message string * @param cause the cause for the exception * @return the exception message string */ public static String buildErrorMessage(ErrorType type, String extraMessage, Throwable cause) { //Initial message is just the error type message StringBuilder message = new StringBuilder(HCatException.class.getName()); message.append(" : " + type.getErrorCode()); message.append(" : " + type.getErrorMessage()); if (extraMessage != null) { //Add the extra message value to buffer message.append(" : " + extraMessage); } if (type.appendCauseMessage()) { if (cause != null) { //Add the cause message to buffer message.append(". Cause : " + cause.toString()); } } return message.toString(); }
/** * Is this a retriable error. * @return is it retriable */ public boolean isRetriable() { return errorType.isRetriable(); }
/** * Gets the error code. * @return the error code */ public int getErrorCode() { return errorType.getErrorCode(); }
for(ErrorType errorType: validationResult.getErrors()) { fieldErrorCodes = new String[]{ errorType.getErrorCode() }; bindingResult.addError(new ObjectError(errorType.getProperty(), fieldErrorCodes , null, null)); if(errorType.getProperty().length() > 0) { bindingResult.addError(new FieldError(bindingResult.getObjectName(), errorType.getProperty(), null, false, fieldErrorCodes, null, null)); } }
exc = e; assertTrue(exc instanceof HCatException); assertTrue(ErrorType.ERROR_DUPLICATE_PARTITION.equals(((HCatException) exc).getErrorType()));
/** * Gets the error code. * @return the error code */ public int getErrorCode() { return errorType.getErrorCode(); }
/** * Builds the error message string. The error type message is appended with the extra message. If appendCause * is true for the error type, then the message of the cause also is added to the message. * @param type the error type * @param extraMessage the extra message string * @param cause the cause for the exception * @return the exception message string */ public static String buildErrorMessage(ErrorType type, String extraMessage, Throwable cause) { //Initial message is just the error type message StringBuffer message = new StringBuffer(HCatException.class.getName()); message.append(" : " + type.getErrorCode()); message.append(" : " + type.getErrorMessage()); if (extraMessage != null) { //Add the extra message value to buffer message.append(" : " + extraMessage); } if (type.appendCauseMessage()) { if (cause != null) { //Add the cause message to buffer message.append(". Cause : " + cause.toString()); } } return message.toString(); }
/** * Gets the error code. * @return the error code */ public int getErrorCode() { return errorType.getErrorCode(); }
/** * Is this a retriable error. * @return is it retriable */ public boolean isRetriable() { return errorType.isRetriable(); }
/** * Builds the error message string. The error type message is appended with the extra message. If appendCause * is true for the error type, then the message of the cause also is added to the message. * @param type the error type * @param extraMessage the extra message string * @param cause the cause for the exception * @return the exception message string */ public static String buildErrorMessage(ErrorType type, String extraMessage, Throwable cause) { //Initial message is just the error type message StringBuffer message = new StringBuffer(HCatException.class.getName()); message.append(" : " + type.getErrorCode()); message.append(" : " + type.getErrorMessage()); if (extraMessage != null) { //Add the extra message value to buffer message.append(" : " + extraMessage); } if (type.appendCauseMessage()) { if (cause != null) { //Add the cause message to buffer message.append(". Cause : " + cause.toString()); } } return message.toString(); }
/** * Gets the error code. * @return the error code */ public int getErrorCode() { return errorType.getErrorCode(); }
/** * Is this a retriable error. * @return is it retriable */ public boolean isRetriable() { return errorType.isRetriable(); }
/** * Builds the error message string. The error type message is appended with the extra message. If appendCause * is true for the error type, then the message of the cause also is added to the message. * @param type the error type * @param extraMessage the extra message string * @param cause the cause for the exception * @return the exception message string */ public static String buildErrorMessage(ErrorType type, String extraMessage, Throwable cause) { //Initial message is just the error type message StringBuilder message = new StringBuilder(HCatException.class.getName()); message.append(" : " + type.getErrorCode()); message.append(" : " + type.getErrorMessage()); if (extraMessage != null) { //Add the extra message value to buffer message.append(" : " + extraMessage); } if (type.appendCauseMessage()) { if (cause != null) { //Add the cause message to buffer message.append(". Cause : " + cause.toString()); } } return message.toString(); }
/** * Gets the error code. * @return the error code */ public int getErrorCode() { return errorType.getErrorCode(); }
/** * Is this a retriable error. * @return is it retriable */ public boolean isRetriable() { return errorType.isRetriable(); }
/** * Builds the error message string. The error type message is appended with the extra message. If appendCause * is true for the error type, then the message of the cause also is added to the message. * @param type the error type * @param extraMessage the extra message string * @param cause the cause for the exception * @return the exception message string */ public static String buildErrorMessage(ErrorType type, String extraMessage, Throwable cause) { //Initial message is just the error type message StringBuffer message = new StringBuffer(HCatException.class.getName()); message.append(" : " + type.getErrorCode()); message.append(" : " + type.getErrorMessage()); if (extraMessage != null) { //Add the extra message value to buffer message.append(" : " + extraMessage); } if (type.appendCauseMessage()) { if (cause != null) { //Add the cause message to buffer message.append(". Cause : " + cause.toString()); } } return message.toString(); }
/** * Is this a retriable error. * @return is it retriable */ public boolean isRetriable() { return errorType.isRetriable(); }