{@inheritdoc}

@throws \Throwable
184579
public function process(ContainerBuilder $container): void
    {
        $loggerDefinition = $container->getDefinition('service_bus.logger');

        if (NullLogger::class === $loggerDefinition->getClass())
        {
            $loggerDefinition->setClass(Logger::class);
            $loggerDefinition->setArguments(['%service_bus.entry_point%']);
        }

        $processors = [
            PsrLogMessageProcessor::class,
            MemoryUsageProcessor::class,
            ProcessIdProcessor::class,
        ];

        foreach ($processors as $processor)
        {
            $container->addDefinitions([$processor => new Definition($processor)]);
            $loggerDefinition->addMethodCall(
                'pushProcessor',
                [new Reference($processor)]
            );
        }
    }
551385
public function logServerError(Throwable $e)
    {
        if ($this->isInTesting()) {
            return;
        }

        $exception = $this->normalizeException($e);
        $this->container->make(ConsoleOutput::class)
            ->writeln(sprintf("<error>%s</error>", $exception));

        $this->container->make(ExceptionHandler::class)
            ->report($exception);
    }
887246
public function register(callable $callback): void
    {
        $hint = $this->handlerHint($callback);

        $this->handlers[$hint] = $callback;
    }
634859
public function onExceptionHandle(\Throwable $e)
    {
        try {
            if ($e->getPrevious()) {
                $ce = $e->getPrevious();
                $errMsg = dump($ce, false, true);
            } else {
                $errMsg = dump($e, false, true);
                $ce = $e;
            }

            $this->getContext()->getLog()->error($errMsg);
            $this->outputJson(parent::$stdClass, 'Internal Server Error', 500);
        } catch (\Throwable $ne) {
            getInstance()->log->error('previous exception ' . dump($ce, false, true));
            getInstance()->log->error('handle exception ' . dump($ne, false, true));
        }
    }
1213564
public function handle($input, $output = null)
    {
        try {
            return $this->run($input, $output);
        }
        catch (Exception $e) {
            $this->manageException($output, $e);

            return 1;
        }
        catch (Throwable $e) {
            $this->manageException($output, new FatalThrowableError($e));

            return 1;
        }
    }
104267
public function fail(\Throwable $throwable)
    {
        Logger::get()->exception($throwable);
        header('Server error', true, 500);
        echo '<h1>Eix</h1>';
        echo 'The application cannot continue.';
        echo '<blockquote>' . $throwable->getMessage() . '</blockquote>';

        if (defined('DEBUG') && DEBUG) {
            echo '<pre>' . $throwable->getTraceAsString() . '</pre>';
        }

        die(-1);
    }
6894
public function log(\Throwable $throwable): void
    {
        $date = (new \DateTime())->format('Y-m-d H:i:s');
        $log = "[$date] {$throwable->getMessage()} at line {$throwable->getLine()} in {$throwable->getFile()}" . PHP_EOL;
        $dirname = dirname($this->logPath);

        if (!is_dir($dirname)) {
            mkdir($dirname, 0755);
        }

        $handle = fopen($this->logPath, 'a');
        fwrite($handle, $log);
        fclose($handle);
    }
183063
public function handleThrowable(ServerRequestInterface $request, ResponseInterface $response, Throwable $throwable)
    {
        return $this
            ->getContentTypeHandler($request)
            ->handleThrowable($request, $response, $throwable);
    }
1143722
public function each(callable $callable): void
	{
		foreach($this->items as $key => $value)
		{
			$this->items[$key] = $callable($value, $key);
		}
	}
281961
public function throwServiceException(\Throwable $exception)
    {
        $exceptionClass = ExceptionInterface::class;

        if (method_exists($exception, 'getFaultCode')) {
            $exceptionClass = $this->getServiceException($exception->getFaultCode());
        }
        if ($exceptionClass !== ExceptionInterface::class) {
            throw new $exceptionClass($exception->getMessage());
        }

        throw new ServerException('Unknown error occurred', 0, $exception);
    }
436822
public function handle($throwable)
    {
        if ($throwable instanceof Exception) {
            $response = $this->handler->handleException($this->defaultRequest, $this->defaultResponse, $throwable);
        } elseif ($throwable instanceof Throwable) {
            $response = $this->handler->handleThrowable($this->defaultRequest, $this->defaultResponse, $throwable);
        } else {
            return false;
        }

        if ($response instanceof ResponseInterface) {
            $this->renderResponse($response);
            return true;
        } else {
            return false;
        }
    }
669363
public function setThrowable(\Throwable $throwable) : Event
    {
        // Setting the Exception after it's already been handled makes no sense. This might potentially lead to
        // confusion in the future as we are not throwing an Exception on our own for this in order not to mess
        // up things while already within an Exception Handler context.
        if ($this->getName() !== definitions\Events::DEBUG_THROWABLE_AFTER) {
            $this->throwable = $throwable;
        }

        return $this;
    }
1372614
public static function fromThrowable($throwable)
    {
        if ($throwable instanceof \Error) {
            $throwable = ErrorException::fromError($throwable);
        }

        if (!$throwable instanceof \Exception) {
            throw new \InvalidArgumentException('throw-up can only throw Exceptions and Errors');
        }

        return new self($throwable);
    }
567503
public function compile(Compiler $compiler): void
    {
        $runtimeErrorClass = RuntimeError::class;
        $suppressedExceptionClass = SuppressedException::class;

        $compiler
            ->write("try {\n")
            ->indent()
            ->write("ob_start();\n\n")
            ->subcompile($this->getNode('body'))
            ->raw("\n")
            ->write("echo ob_get_clean();\n")
            ->outdent()
            ->write("} catch ({$runtimeErrorClass} \$exception) {\n")
            ->indent()
            ->write("ob_end_clean();\n\n")
            ->write("if (\$exception->getPrevious() === null) {\n")
            ->indent()
            ->write("throw \$exception;\n")
            ->outdent()
            ->write("}\n\n")
            ->write("\$suppressedException = new {$suppressedExceptionClass}(\$exception->getPrevious());\n")
            ->outdent()
            ->write("}\n\n");
    }
725549
protected function throwThrowableMiddleware(Throwable $error) : MiddlewareInterface
    {
        return new class($error) implements MiddlewareInterface
        {
            protected $error;

            public function __construct(Throwable $error)
            {
                $this->error = $error;
            }

            public function process(
                ServerRequestInterface $request,
                RequestHandlerInterface $requestHandler
            ) : ResponseInterface {
                throw $this->error;
            }
        };
    }
308109
public function execute($data, $value = null) {
        try {
            $config = $this->sanitizeConfig($data);
            if ($value != null)
                $config->value = number_format(floatval($value), 2, '.', '');
            $this->isConciliate($config);
            if (!$this->doRefund($config))
            throw new \Exception('impossible to refund');

            $this->doUpdates($config);
            return true;
        } catch (\Exception $exception) {
            $error = simplexml_load_string($exception->getMessage());
            throw new \Exception((string)$error->error->code);
        }
    }
416605
public function handle(Throwable $throwable)
    {
        if (!Configure::read('CakeMonitor.Sentry.enabled') || error_reporting() === 0) {
            return false;
        }

        $errorHandler = new \Raven_ErrorHandler($this->_ravenClient);
        $errorHandler->registerShutdownFunction();
        $errorHandler->handleException($throwable);
    }