Replies: 1 comment
-
Hi @ecfxs ,The quick fix for you is to edit Incase: You are not doing exception handling with /**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register(): void
{
$this->renderable(function (Throwable $ex, $request) {
return ExceptionHandlerHelper::handle($ex, $request);
});
} Next, update the register method as follows /**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register(): void
{
$this->renderable(function (\Throwable $ex, $request) {
$response = ExceptionHandlerHelper::render($request, $ex);
// Get response data from json response
$data = $response->getData(true);
// Modify the response format as needed
$date = new \DateTime();
$data['timezone'] = $date->getTimezone();
$data['timestamp'] = $date->getTimestamp();
// Update the json response with new data
$response->setData($data);
return $response;
});
} The process involvesRendering the response using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Steps to reproduce the behavior:
I defined a app/Http/Response/RB.php

And used ExceptionHandlerHelper
How can I return the error message in the RB format I defined?
This is the default format

This is not the format I want
Thank you
Environment
Beta Was this translation helpful? Give feedback.
All reactions