Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setTraceFromThrowable example
$statusCode
??= 500;
if
(
class_exists
(
Response::
class
)
&&
isset
(
Response::
$statusTexts
[
$statusCode
]
)
)
{
$statusText
= Response::
$statusTexts
[
$statusCode
]
;
}
else
{
$statusText
= 'Whoops, looks like something went wrong.';
}
$e
->
setStatusText
(
$statusText
)
;
$e
->
setStatusCode
(
$statusCode
)
;
$e
->
setHeaders
(
$headers
)
;
$e
->
setTraceFromThrowable
(
$exception
)
;
$e
->
setClass
(
get_debug_type
(
$exception
)
)
;
$e
->
setFile
(
$exception
->
getFile
(
)
)
;
$e
->
setLine
(
$exception
->
getLine
(
)
)
;
$previous
=
$exception
->
getPrevious
(
)
;
if
(
$previous
instanceof \Throwable
)
{
$e
->
setPrevious
(
static
::
createFromThrowable
(
$previous
)
)
;
}
return
$e
;
}
$statusCode
??= 500;
if
(
class_exists
(
Response::
class
)
&&
isset
(
Response::
$statusTexts
[
$statusCode
]
)
)
{
$statusText
= Response::
$statusTexts
[
$statusCode
]
;
}
else
{
$statusText
= 'Whoops, looks like something went wrong.';
}
$e
->
setStatusText
(
$statusText
)
;
$e
->
setStatusCode
(
$statusCode
)
;
$e
->
setHeaders
(
$headers
)
;
$e
->
setTraceFromThrowable
(
$exception
)
;
$e
->
setClass
(
get_debug_type
(
$exception
)
)
;
$e
->
setFile
(
$exception
->
getFile
(
)
)
;
$e
->
setLine
(
$exception
->
getLine
(
)
)
;
$previous
=
$exception
->
getPrevious
(
)
;
if
(
$previous
instanceof \Throwable
)
{
$e
->
setPrevious
(
static
::
createFromThrowable
(
$previous
)
)
;
}
return
$e
;
}