设置异常

@param cause 异常类型
195847
public void setFailure(Throwable cause) {
        if (this.isCancelled()) {
            this.releaseIfNeed(result);
            return;
        }
        if (setFailure0(cause)) {
            notifyListeners();
            return;
        }
        throw new IllegalStateException("complete already: " + this, cause);
    }
1213886
public static RuntimeException initCause(RuntimeException ex,
                                             Throwable cause)
    {
        if (Throwable_initCause != null) {
            Object[] args = { cause };
            try {
                Throwable_initCause.invoke(ex, args);
            } catch (Exception e) {
                // Ignore any exceptions
            }
        }
        return ex;
    }
107505
public void requestFailed (final Exception cause)
    {
        EventQueue.invokeLater(new Runnable() {
            public void run () {
                _target.requestFailed(cause);
            }
        });
    }
374398
public static <T>CompletableFuture<T> completedExceptionally(Throwable cause) {
		CompletableFuture<T> result = new CompletableFuture<>();
		result.completeExceptionally(cause);

		return result;
	}
768637
private Throwable getCause(Throwable t) {
        Throwable cause = t.getCause();
        if (t.getCause() != null) {
            return cause;
        } else {
            return t;
        }
    }
863883
@SuppressWarnings("unchecked")
	public static Throwable getCausedBy(Throwable throwable, Class<? extends Exception>... causeClasses) {
		Throwable cause = throwable;
		while (cause != null) {
			for (Class<? extends Exception> causeClass : causeClasses) {
				if (causeClass.isInstance(cause)) {
					return cause;
				}
			}
			cause = cause.getCause();
		}
		return null;
	}
174069
public static void fireCause(Throwable t) {
        if (t != null) {
            Throwable cause = t.getCause();
            if (cause == null) {
                cause = t;
            }
            fire(cause);
        }
    }
818041
public void restart(RuntimeException cause) {
        if (isProdMode()) throw cause;
        if (!(cause instanceof ClassReloadException)) {
            String msg = cause.getMessage();
            if (cause instanceof RythmException) {
                RythmException re = (RythmException) cause;
                msg = re.getSimpleMessage();
            }
            logger.warn("restarting rythm engine due to %s", msg);
        }
        restart();
    }
1158818
public function initializeObject($cause): void
    {
        parent::initializeObject($cause);
        if ($cause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
            $this->migrateConfigurationForElasticVersion5($this->defaultConfigurationPerType);
        }
    }
745774
public void requestFailed (Exception cause)
    {
        Object[] args = _args != null ? ArrayUtil.append(_args, cause) : new Object[] { cause };
        if (_slogger != null) {
            _slogger.warning(_errorText, args);
        } else if (_jlogger != null) {
            _jlogger.log(Level.WARNING, Logger.format(_errorText, args), cause);
        } else {
            System.err.println(Logger.format(_errorText, args));
        }
    }
982504
public boolean setException(TBase<?, ?> result, Throwable cause) {
        final Class<?> causeType = cause.getClass();
        for (Entry<Class<Throwable>, TFieldIdEnum> e : exceptionFields.entrySet()) {
            if (e.getKey().isAssignableFrom(causeType)) {
                ThriftFieldAccess.set(result, e.getValue(), cause);
                return true;
            }
        }
        return false;
    }
770055
public static DeleteException fromThrowable(Throwable cause) {
    return (cause instanceof DeleteException)
                   ? (DeleteException) cause
                   : new DeleteException(cause);
  }
638646
public void add(String message, IOException cause) {
        causes.add(new IOException(message, cause));
    }
583524
protected IOException newTimeoutException(IOException cause) {
    InterruptedIOException e = new InterruptedIOException("timeout");
    if (cause != null) {
      e.initCause(cause);
    }
    return e;
  }
469875
public void release(Throwable cause) {
		if (isReleased.compareAndSet(false, true)) {
			LOG.debug("{}: Releasing {}.", owningTaskName, this);

			// Set the error cause
			if (cause != null) {
				this.cause = cause;
			}

			// Release all subpartitions
			for (ResultSubpartition subpartition : subpartitions) {
				try {
					subpartition.release();
				}
				// Catch this in order to ensure that release is called on all subpartitions
				catch (Throwable t) {
					LOG.error("Error during release of result subpartition: " + t.getMessage(), t);
				}
			}
		}
	}
122491
public boolean causeInstanceOf(Class<? extends Throwable> clazz) {
		Throwable cause = this.getCause();
		if (null != cause && clazz.isInstance(cause)) {
			return true;
		}
		return false;
	}
1009406
public void onError(Throwable cause) {
    if (cause instanceof StatusRuntimeException
        && ((StatusRuntimeException) cause).getStatus().getCode() == Status.Code.CANCELLED) {
      // Cancellation is already handled.
      return;
    }
    mSerializingExecutor.execute(() -> {
      LogUtils.warnWithException(LOG, "Exception thrown while handling write request {}",
          mContext == null ? "unknown" : mContext.getRequest(), cause);
      abort(new Error(AlluxioStatusException.fromThrowable(cause), false));
    });
  }