Carry headers when rethrowing errors to REST
This commit is contained in:
@@ -39,13 +39,16 @@ class GenericException extends HttpException
|
|||||||
*/
|
*/
|
||||||
public function getErrorMetadata(): array
|
public function getErrorMetadata(): array
|
||||||
{
|
{
|
||||||
|
$metadata = [];
|
||||||
|
$metadata['error'] = [
|
||||||
|
'original_exception' => get_class($this->exception),
|
||||||
|
];
|
||||||
|
|
||||||
// Only add trace if in dev
|
// Only add trace if in dev
|
||||||
if (config('app.env') === 'dev') {
|
if (config('app.env') === 'dev') {
|
||||||
return [
|
$metadata['trace'] = $this->exception->getTrace()[0];
|
||||||
'trace' => $this->exception->getTrace()[0],
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return $metadata;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ class SymfonyException extends HttpException
|
|||||||
$this->exception = $exception;
|
$this->exception = $exception;
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
$exception->getStatusCode(),
|
$exception->getStatusCode(),
|
||||||
$exception->getMessage()
|
$exception->getMessage(),
|
||||||
|
null,
|
||||||
|
$exception->getHeaders()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,7 +25,7 @@ class SymfonyException extends HttpException
|
|||||||
*/
|
*/
|
||||||
public function getErrorType(): string
|
public function getErrorType(): string
|
||||||
{
|
{
|
||||||
return 'internal-error';
|
return 'http-exception';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user