src/Handlers/ExceptionHandler.php
private function convertException(Exception $e)
    {
        $data = [];
        $data['message']  = $e->getMessage();
        $data['code']     = $e->getCode();
        $data['trace']    = $this->filterTrace($e->getTrace());
        $data['status']   = Response::HTTP_INTERNAL_SERVER_ERROR;

        // determine the relevant file
        $firstTraceEntry = !empty($data['trace']) ? reset($data['trace']) : null;
        if ($firstTraceEntry !== null && isset($firstTraceEntry['file']) && isset($firstTraceEntry['line'])) {
            $data['file'] = $firstTraceEntry['file'];
            $data['line'] = $firstTraceEntry['line'];
        }
        else {
            $data['file'] = $e->getFile();
            $data['line'] = $e->getLine();
        }

        if ($e instanceof HttpException) {
            $data['status'] = $e->getStatusCode() ?: Response::HTTP_INTERNAL_SERVER_ERROR;
        }
        else if ($e instanceof QueryException) {
            $data['ansiCode']   = isset($e->errorInfo[0]) ? $e->errorInfo[0] : null;
            $data['driverCode'] = isset($e->errorInfo[1]) ? $e->errorInfo[1] : null;
            if (!empty($e->errorInfo[2])) {
                $data['message'] = $e->errorInfo[2];
            }
            $data['sql'] = $e->getDump();
        }

        return $data;
    }
private function convertException(Exception $e)
    {
        $data = [];
        $data['message']  = $e->getMessage();
        $data['code']     = $e->getCode();
        $data['trace']    = $this->filterTrace($e->getTrace());
        $data['status']   = Response::HTTP_INTERNAL_SERVER_ERROR;

        // determine the relevant file
        $firstTraceEntry = !empty($data['trace']) ? reset($data['trace']) : null;
        if ($firstTraceEntry !== null && isset($firstTraceEntry['file']) && isset($firstTraceEntry['line'])) {
            $data['file'] = $firstTraceEntry['file'];
            $data['line'] = $firstTraceEntry['line'];
        }
        else {
            $data['file'] = $e->getFile();
            $data['line'] = $e->getLine();
        }

        if ($e instanceof HttpException) {
            $data['status'] = $e->getStatusCode() ?: Response::HTTP_INTERNAL_SERVER_ERROR;
        }
        else if ($e instanceof QueryException) {
            $data['ansiCode']   = isset($e->errorInfo[0]) ? $e->errorInfo[0] : null;
            $data['driverCode'] = isset($e->errorInfo[1]) ? $e->errorInfo[1] : null;
            if (!empty($e->errorInfo[2])) {
                $data['message'] = $e->errorInfo[2];
            }
            $data['sql'] = $e->getDump();
        }

        return $data;
    }
private function convertException ( Exception $ e ) { $ data = [ ] ; $ data [ 'message' ] = $ e -> getMessage ( ) ; $ data [ 'code' ] = $ e -> getCode ( ) ; $ data [ 'trace' ] = $ this -> filterTrace ( $ e -> getTrace ( ) ) ; $ data [ 'status' ] = Response :: HTTP_INTERNAL_SERVER_ERROR ; // determine the relevant file $ firstTraceEntry = ! empty ( $ data [ 'trace' ] ) ? reset ( $ data [ 'trace' ] ) : null ; if ( $ firstTraceEntry !== null && isset ( $ firstTraceEntry [ 'file' ] ) && isset ( $ firstTraceEntry [ 'line' ] ) ) { $ data [ 'file' ] = $ firstTraceEntry [ 'file' ] ; $ data [ 'line' ] = $ firstTraceEntry [ 'line' ] ; } else { $ data [ 'file' ] = $ e -> getFile ( ) ; $ data [ 'line' ] = $ e -> getLine ( ) ; } if ( $ e instanceof HttpException ) { $ data [ 'status' ] = $ e -> getStatusCode ( ) ? : Response :: HTTP_INTERNAL_SERVER_ERROR ; } else if ( $ e instanceof QueryException ) { $ data [ 'ansiCode' ] = isset ( $ e -> errorInfo [ 0 ] ) ? $ e -> errorInfo [ 0 ] : null ; $ data [ 'driverCode' ] = isset ( $ e -> errorInfo [ 1 ] ) ? $ e -> errorInfo [ 1 ] : null ; if ( ! empty ( $ e -> errorInfo [ 2 ] ) ) { $ data [ 'message' ] = $ e -> errorInfo [ 2 ] ; } $ data [ 'sql' ] = $ e -> getDump ( ) ; } return $ data ; }
Convert a Exception to a simple array.

@param Exception $e
@return array
Convert a Exception to a simple array .