If $this->exceptionsDuringImport is non-empty, build up a new composite exception which contains the individual messages and
re-throw that one.
436577
protected function handleExceptionsDuringExport()
    {
        if (count($this->exceptionsDuringExport) > 0) {
            $exceptionMessages = '';
            foreach ($this->exceptionsDuringExport as $i => $exception) {
                $exceptionMessages .= "\n" . $i . ': ' . get_class($exception) . "\n" . $exception->getMessage() . "\n";
            }

            throw new ExportException(sprintf('%s exceptions occurred during export. Please see the log for the full exceptions (including stack traces). The exception messages follow below: %s', count($this->exceptionsDuringExport), $exceptionMessages), 1409057360);
        }
    }
895027
public function checkForFatalErrors() {
		// in case of memory size exhausted error
		gc_collect_cycles();
// 		$this->checkForPendingLogExceptions();
		
		$error = error_get_last();
		
		if (!isset($error) || $this->checkForError($error['type'], $error['file'], $error['line'], $error['message'])) {
			return;
		}
				
// 		if ($error['type'] == E_WARNING && substr($error['message'], 0, 23) == 'DateTime::__construct()') {
// 			return;
// 		}
		
// 		if (!$this->strictAttitude || ($error['type'] & self::STRICT_ATTITUTE_PHP_SEVERITIES)) {
// 			return;
// 		}
		
		try {
			$this->handleTriggeredError($error['type'], $error['message'], $error['file'], $error['line'], null, true);
		} catch (\Throwable $e) {
			$this->dispatchException($e);
		}

		$this->checkForPendingLogExceptions();
	}
920899
public function appendException()
    {
        foreach (func_get_args() as $value) {
            if ($value instanceof \Exception || $value instanceof \Throwable) {
                $this->queue[] = $value;
            } else {
                throw new \InvalidArgumentException('Expected an \Exception or \Throwable.');
            }
        }
    }
897198
private void incrementExceptions() {
        // if the gap between the first exception and this newest one is over
        // 10 minutes, reset the counter since we're not on a tight loop of
        // errors
        long now = CHFWBundle.getApproxTime();
        if ((now - this.firstErrorTime) >= TEN_MINUTES) {
            this.numExceptions = 1;
            this.firstErrorTime = now;
            // reset the individual exception counters too
            this.numAcceptIOExceptions = 0;
            this.numAcceptNulls = 0;
            this.numCancelledKeys = 0;
            this.numConfigureIOExceptions = 0;
        } else {
            this.numExceptions++;
        }
    }
209707
private function throwExceptionIfErrorOccurred()
    {
        $errorResultCodes = [
            \Memcached::RES_FAILURE,
            \Memcached::RES_SERVER_TEMPORARILY_DISABLED,
            \Memcached::RES_SERVER_MEMORY_ALLOCATION_FAILURE,
        ];

        if (in_array($this->memcached->getResultCode(), $errorResultCodes, true)) {
            throw new StorageException($this->memcached->getResultMessage());
        }
    }
599953
private function createAndDispatchTransportException($message, AnyException $exception)
    {
        $transportException = new Swift_TransportException($message, 0, $exception);

        if ($event = $this->eventDispatcher->createTransportExceptionEvent($this, $transportException)) {
            $this->eventDispatcher->dispatchEvent($event, 'exceptionThrown');
        }

        return $transportException;
    }
782
public function handleError()
    {
        // get error info
        list ($errno, $message, $file, $line) = func_get_args();

        // construct error message
        $msg = "ERROR ($errno): $message";
        if ($line !== null) {
            $file = "$file:$line";
        }

        if ($file !== null) {
            $msg .= " [$file]";
        }

        static::$lastErrno = $errno;

        // throw the exception
        throw new RuntimeException($msg, $errno);
    }
938238
protected function throwExceptions()
    {
        $status = $this->getStatusCode();

        switch ($status) {
            case 400:
                throw new ValidationException($this);
                break;
            case 401:
                throw new UnauthorizedException($this);
                break;
            case 404:
                throw new ResourceNotFoundException($this);
                break;
            default:
                //
                break;
        }

        if ($status >= 400 && $status < 500) {
            throw new ClientRequestException($this, 'Whoops looks like something went wrong');
        } elseif ($status >= 500) {
            throw new ServerRequestException($this);
        }
    }
540288
protected function _throwRendererException(
        $message = null,
        $code = null,
        RootException $previous = null
    ) {
        return $this->_createRendererException($message, $code, $previous, $this);
    }
1136554
function Exception(message, innerException) {
  if (!message) {
    throw new Exception("Argument 'message' is required but was '" +
      (message === null ? "null" : "undefined") + "'");
  }
  if (typeof message !== 'string') {
    throw new Exception("Argument 'message' must be of type 'string' but was '" + typeof message + "'");
  }

  if (innerException === undefined && typeof message !== 'string') {
    innerException = message;
    message = innerException.message || innerException.toString();
  }

  this.message = message;
  this.innerException = innerException;
  this.toString = function () {
    return message;
  };
}
1069594
protected function _throwIteratorException(
        $message = null,
        $code = null,
        RootException $previous = null
    ) {
        throw $this->_createIteratorException($message, $code, $previous, $this);
    }
120170
public static void throwRuntimeException(Throwable t)
    {
        // Unchecked? Can re-throw as is
        throwIfUnchecked(t);
        // Otherwise, let's just change its type:
        throw new RuntimeException("[was "+t.getClass()+"] "+t.getMessage(), t);
    }
719276
public void afterThrowing(Throwable original) throws Throwable {

        Class<?> candidateType = original.getClass();
        Throwable candidate = original;

        if (ClassUtils.isAssignable(MessageException.class, candidateType)) {
            MessageException me = (MessageException) candidate;
            if (SERVER_PROCESSING_CODE.equals(me.getCode()) && me.getRootCause() != null) {
                candidateType = me.getRootCause().getClass();
                candidate = me.getRootCause();
            }
        }

        for (ExceptionTranslator translator : this.exceptionTranslators) {
            if (translator.handles(candidateType)) {
                MessageException result = translator.translate(candidate);
                if (result != null) {
                	exceptionLogger.log(result);
                    throw result;
                }
            }
        }
        exceptionLogger.log(original);
        throw original;
    }
988070
public static void throwConcatException(CodeBuilder b, Class type, String... messages) {
        if (messages == null || messages.length == 0) {
            throwException(b, type, null);
            return;
        }
        if (messages.length == 1) {
            throwException(b, type, messages[0]);
            return;
        }

        TypeDesc desc = TypeDesc.forClass(type);
        b.newObject(desc);
        b.dup();

        TypeDesc[] params = new TypeDesc[] {TypeDesc.STRING};

        for (int i=0; i<messages.length; i++) {
            b.loadConstant(String.valueOf(messages[i]));
            if (i > 0) {
                b.invokeVirtual(TypeDesc.STRING, "concat", TypeDesc.STRING, params);
            }
        }

        b.invokeConstructor(desc, params);
        b.throwObject();
    }
776755
protected function createDetailFromException()
    {
        $e = $this->detail;

        if (!$this->detailIncludesStackTrace) {
            return $this->getExceptionMessage($e);
        }

        $message = $this->getExceptionMessage($e);
        $this->additionalDetails['trace'] = $e->getTrace();

        $previous = [];
        $e = $e->getPrevious();
        while ($e) {
            $previous[] = [
                'code'    => (int) $e->getCode(),
                'message' => $this->getExceptionMessage($e),
                'trace'   => $e->getTrace(),
            ];
            $e = $e->getPrevious();
        }
        if (count($previous)) {
            $this->additionalDetails['exception_stack'] = $previous;
        }

        return $message;
    }
672650
public function tryAnException()
    {
        try {
            $iterator = $this->endpoint->listRecords('foobardoesnotexist');
            $iterator->current();
        } catch (\Phpoaipmh\Exception\OaipmhException $e) {
            throw $e;
        }
    }
1024629
public function assertIsStringAndNonEmpty($value, $message='%s must be a string and not empty', $exception='Asserts')
    {
        if (is_string($value) === false || strlen($value) < 1) {
            $this->throwException($exception, $message, $value);
        }
    }