+ /**
+ * Constructs a new instance with the specified detail message and cause.
+ *
+ * @param message the detail message
+ * @param cause the cause
+ * @throws NullPointerException if {@code message} is {@code null}
+ */
+ public OperationFailedException(final String message, final Throwable cause) {
+ super(requireNonNull(message), cause);
+ errorList = null;
+ }
+
+ /**
+ * Constructs a new instance with the specified detail message and error.
+ *
+ * @param message the detail message
+ * @param error {@link RpcError} instance that provides additional error information about this exception
+ * @throws NullPointerException if any argument is {@code null}
+ */
+ public OperationFailedException(final String message, final RpcError error) {
+ super(requireNonNull(message));
+ errorList = ImmutableList.of(error);
+ }
+
+ /**
+ * 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
+ * @throws NullPointerException if either {@code message} or {@code errors} is {@code null}, or if {@code errors}
+ * contains a {@code null} element.
+ */
+ public OperationFailedException(final String message, final Throwable cause, final Collection<RpcError> errors) {
+ super(requireNonNull(message), cause);
+ errorList = errors.isEmpty() ? null : ImmutableList.copyOf(errors);
+ }
+
+ /**
+ * Constructs a new instance with the specified detail message and errors.
+ *
+ * @param message the detail message
+ * @param errors {@link RpcError} instances that provide additional error information about this exception
+ * @throws NullPointerException if any argument is, or {@code errors} contains, {@code null}
+ */
+ public OperationFailedException(final String message, final Collection<? extends RpcError> errors) {
+ super(requireNonNull(message));
+ this.errorList = ImmutableList.copyOf(errors);
+ }
+