Add exceptions to the collection

@param ExceptionCollection|\Exception $e Exception to add

@return ExceptionCollection;
546040
public function add($e)
    {
        $this->exceptions[] = $e;
        if ($this->message) {
            $this->message .= "\n";
        }

        $this->message .= $this->getExceptionMessage($e, 0);

        return $this;
    }
806745
protected function handleException(\Exception $e)
    {
        $data = [];

        if ($this->controller->app->get('system.debug')) {
            $data['exception'] = get_class($e);
            $data['backtrace'] = BacktraceHelper::normalizeBacktraces($e->getTrace());

            foreach ($data['backtrace'] as &$datum) {
                unset($datum['pathname']);
            }

            if (class_exists(DebuggerHelper::class)) {
                try {
                    $data['debug_messages'] = (array) DebuggerHelper::getInstance()->get('debug.messages');
                } catch (\Exception $e) {
                    // None
                }
            }
        }

        $this->controller->setResponse(
            $this->controller
                ->getResponse()
                ->withStatus(
                    ErrorManager::normalizeCode($e->getCode()),
                    ErrorManager::normalizeMessage($e->getMessage())
                )
        );

        $message = !WINDWALKER_DEBUG ? $e->getMessage() : sprintf(
            '#%d %s - File: %s (%d)',
            $e->getCode(),
            $e->getMessage(),
            $e->getFile(),
            $e->getLine()
        );

        return new JsonBuffer($message, $data, false, $e->getCode());
    }
896310
public static function fromException(\Exception $e)
    {
        if ($e instanceof XsollaWebhookException) {
            return static::fromErrorCode($e->getXsollaErrorCode(), $e->getMessage(), $e->getHttpStatusCode());
        } else {
            return static::fromErrorCode('FATAL_ERROR', $e->getMessage());
        }
    }
604314
public static function raiseError(\Exception $e)
	{
		if(self::$debug)
			self::$debugData .= "Exception at " . basename($e->getFile()) . ":"
				. $e->getLine() . ": " . self::makePrintable($e->getMessage())
				. "\n";
	}
1127824
protected function exception(array $e): \Closure
    {
        return function () use ($e) {
            $exClass = $e[0];
            $message = $e[1];

            throw new $exClass($message);
        };
    }
723156
public static function translate(\Exception $e): \Exception
    {
        if ($e instanceof \MongoDB\Driver\Exception\ConnectionException ||
                $e instanceof \MongoDB\Driver\Exception\ExecutionTimeoutException) {
            return new \Caridea\Dao\Exception\Unreachable("System unreachable or connection timed out", $e->getCode(), $e);
        } elseif ($e instanceof \MongoDB\Driver\Exception\InvalidArgumentException ||
                $e instanceof \MongoDB\Driver\Exception\LogicException ||
                $e instanceof \MongoDB\Exception\BadMethodCallException) {
            return new \Caridea\Dao\Exception\Inoperable("Invalid API usage", $e->getCode(), $e);
        } elseif ($e instanceof \MongoDB\GridFS\Exception\FileNotFoundException ||
                $e instanceof \MongoDB\GridFS\Exception\CorruptFileException) {
            return new \Caridea\Dao\Exception\Unretrievable("Data could not be retrieved", $e->getCode(), $e);
        } elseif ($e instanceof \MongoDB\Driver\Exception\RuntimeException &&
                ($e->getCode() == 11000 || 'E11000' == substr($e->getMessage(), 0, 6))) {
            return new \Caridea\Dao\Exception\Duplicative("Unique constraint violation", 409, $e);
        } elseif ($e instanceof \MongoDB\Driver\Exception\BulkWriteException &&
                $e->getMessage() == 'Document failed validation') {
            return new \Caridea\Dao\Exception\Violating("Constraint violation", 422, $e);
        }
        return new \Caridea\Dao\Exception\Generic("Uncategorized database error", 0, $e);
    }
1285459
private function _exceptionHandler($e)
    {
        $this->_errorController->setParams(array('e' => $e));
        $action = FrontController::EXCEPTION_HANDLER_ACTION . 'Action';
        $this->_response->setStatusCode(500);

        return $this->_errorController->$action();
    }
911614
private function wrapException(\Exception $e)
    {
        if ($e instanceof ClientException && $e->getResponse()->getStatusCode() == 404) {
            return NotFoundException::wrap($e);
        }

        return ErrorException::wrap($e);
    }
788284
public static function exceptionHandler(\Throwable $e) {
		$code = $e->getCode();
		if (get_class($e) == 'Object\Error\UserException') {
			$code = -1;
		}
		self::$errors[] = [
			'errno' => $code,
			'error' => [$e->getMessage()],
			'file' => $e->getFile(),
			'line' => $e->getLine(),
			'code' => self::getCode($e->getFile(), $e->getLine()),
			'backtrace' => self::debugBacktraceString($e->getTrace())
		];
		self::$flag_exception = true;
		exit;
	}
1276555
public function logErrorException(\Exception $e)
    {
        if ($this->getServerContext()->hasLogger(LoggerUtils::SYSTEM)) {
            $this->getServerContext()->getLogger(LoggerUtils::SYSTEM)->error($e->__toString());
        }
    }
1289270
protected function handleException(\Exception $e)
    {
        $errors = [];

        $scannedException = $e;
        while ($scannedException) {
            $errors[] = $scannedException->getMessage();
            $errors[] = 'In ' . $scannedException->getFile() . ' on line ' . $scannedException->getLine();
            $scannedException = $scannedException->getPrevious();
        }

        return $this->notify($errors, 'error');
    }
267240
public function exceptionHandler($e) {
        if (method_exists($e, 'getType')) {
            $this->addError($e->getMessage(), $e->getFile(), $e->getLine(), $e->getType());
        }
        else {
            $this->addError($e->getMessage(), $e->getFile(), $e->getLine(), gettype($e));
        }
    }
479349
public function formatException(\Exception $e) {
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->writeElement('class', get_class($e));
        $xml->writeElement('message', htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8'));
        $xml->writeElement('file', htmlspecialchars($e->getFile(), ENT_QUOTES, 'UTF-8'));
        $xml->writeElement('line', $e->getLine());
        $xml->writeElement('trace', htmlspecialchars($e->getTraceAsString(), ENT_QUOTES, 'UTF-8'));

        return $xml->outputMemory();
    }
174226
public function add($e)
    {
        if ($this->message) {
            $this->message .= "\n";
        }

        if ($e instanceof self) {
            $this->message .= '(' . get_class($e) . ")";
            foreach (explode("\n", $e->getMessage()) as $message) {
                $this->message .= "\n    {$message}";
            }
        } elseif ($e instanceof \Exception) {
            $this->exceptions[] = $e;
            $this->message .= '(' . get_class($e) . ') ' . $e->getMessage();
        }

        return $this;
    }
1039640
public function exception(\Exception $e, array $options = [])
    {
        $message = $this->createExceptionMessages($e);
        return $this->message($message);
    }
1170323
public function feedPDOException(\PDOException $e) {
		$this->errorInfo = $e->errorInfo;
		$this->message = $e->getMessage();
		$this->code = $e->getCode();
		$this->file = $e->getFile();
		$this->line = $e->getLine();
		return $this;
	}
1279693
protected function addError(\Exception $exception)
    {
        $this->errorList[$exception->getCode()] = [
            'message'   => $exception->getMessage(),
            'line'      => $exception->getLine(),
            'file'      => $exception->getFile(),
            'trace'     => $exception->getTraceAsString(),
        ];
        $this->hasErrors = true;

        return $this;
    }