class ErrorResponseFactory{ public function getResponseFromException(\Throwable
$exception, bool
$debug = false
): Response
{ $response =
new JsonResponse( null,
$this->
getStatusCodeFromException($exception),
$this->
getHeadersFromException($exception) );
$response->
setEncodingOptions($response->
getEncodingOptions() | \JSON_INVALID_UTF8_SUBSTITUTE
);
$response->
setData(['errors' =>
$this->
getErrorsFromException($exception,
$debug)]);
return $response;
} /**
* @return array<DefaultExceptionData|ShopwareExceptionData>
*/
public function getErrorsFromException(\Throwable
$exception, bool
$debug = false
): array
{ if ($exception instanceof ShopwareHttpException
) { $errors =
[];