@Override public String toString() { return MoreObjects.toStringHelper(this).add("message", getMessage()) .add("errorList", errorList).toString(); } }
/** * Constructs a new instance with the specified detail message, cause and errors. * * @param message the detail message * @param cause the cause * @param errors {@link RpcError} instances that provide additional error information about * this exception */ public OperationFailedException(final String message, final Throwable cause, final RpcError... errors) { super(requireNonNull(message), cause); if (errors != null && errors.length > 0) { errorList = ImmutableList.copyOf(Arrays.asList(errors)); } else { // Add a default RpcError. errorList = ImmutableList.of(RpcResultBuilder.newError(ErrorType.APPLICATION, null, getMessage(), null, null, getCause())); } }
private static void propagateExceptionAs(String uriPath, Exception e, String operation) throws OperationFailedException { LOG.debug("Error for uriPath: {}", uriPath, e); if(e instanceof RestconfDocumentedException) { throw new OperationFailedException(String.format("%s failed for URI %s", operation, uriPath), e.getCause(), toRpcErrors(((RestconfDocumentedException)e).getErrors())); } throw new OperationFailedException(String.format("%s failed for URI %s", operation, uriPath), e); }
/** * Constructs a new instance with the specified detail message, cause and errors. * * @param message the detail message * @param cause the cause * @param errors {@link RpcError} instances that provide additional error information about * this exception */ public OperationFailedException(final String message, final Throwable cause, final RpcError... errors) { super(requireNonNull(message), cause); if (errors != null && errors.length > 0) { errorList = ImmutableList.copyOf(Arrays.asList(errors)); } else { // Add a default RpcError. errorList = ImmutableList.of(RpcResultBuilder.newError(ErrorType.APPLICATION, null, getMessage(), null, null, getCause())); } }
@Override public String toString() { return MoreObjects.toStringHelper(this).add("message", getMessage()) .add("errorList", errorList).toString(); } }