src/Foundation/Exceptions/ExceptionHandler.php
protected function convertExceptionToServiceException(Exception $e): ServiceException
    {
        $exception = get_class($e);
        $conversion = $this->container['config']->get('exception.conversion', []);

        if (isset($conversion[$exception])) {
            return new $conversion[$exception]($e->getMessage(), $e->getCode(), $e);
        } /*else if (in_array($exception, $conversion, true)) {
            return new ServiceException($e->getMessage(), 400, $e);
        }*/ else {
            $statusCode = method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 400;

            return new ServiceException($e->getMessage(), $statusCode, $e);
        }
    }
protected function convertExceptionToServiceException(Exception $e): ServiceException
    {
        $exception = get_class($e);
        $conversion = $this->container['config']->get('exception.conversion', []);

        if (isset($conversion[$exception])) {
            return new $conversion[$exception]($e->getMessage(), $e->getCode(), $e);
        } /*else if (in_array($exception, $conversion, true)) {
            return new ServiceException($e->getMessage(), 400, $e);
        }*/ else {
            $statusCode = method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 400;

            return new ServiceException($e->getMessage(), $statusCode, $e);
        }
    }
protected function convertExceptionToServiceException ( Exception $ e ) : ServiceException { $ exception = get_class ( $ e ) ; $ conversion = $ this -> container [ 'config' ] -> get ( 'exception.conversion' , [ ] ) ; if ( isset ( $ conversion [ $ exception ] ) ) { return new $ conversion [ $ exception ] ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } /*else if (in_array($exception, $conversion, true)) {
            return new ServiceException($e->getMessage(), 400, $e);
        }*/ else { $ statusCode = method_exists ( $ e , 'getStatusCode' ) ? $ e -> getStatusCode ( ) : 400 ; return new ServiceException ( $ e -> getMessage ( ) , $ statusCode , $ e ) ; } }
Convert other exception to service exception.

@param Exception $e
@return ServiceException
Convert other exception to service exception .