Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: exception handler not recognize Responsable trait #11

Merged
merged 2 commits into from
Dec 13, 2022

Conversation

axmad386
Copy link
Member

  • fix: exception handler not recognize Responsable trait
  • docs: add explanation how to handle exception manually

this will also close #7

Comment on lines +156 to +160
### Handling Exception Manually

If you want to handle all exceptions manually, please not that you must convert `ApiResponse` to `JsonResponse` by call
`toResponse` method explicitly. See this example:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll rework some of the wording. but thank you @axmad386 for laying out the base.

Comment on lines 35 to +38
return ApiResponse::error($traces ? ['_traces' => $traces] : [])
->message($self->getMessage($e))
->statusCode($self->getStatusCode($e));
->statusCode($self->getStatusCode($e))
->toResponse($request);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am curious can we do something like this:

$apiResponse = ApiResponse::error(); //...

return response($apiResponse);

nevertheles, this one is also oke. thank you mas!

@lakuapik lakuapik merged commit 2b89ddc into main Dec 13, 2022
@lakuapik lakuapik deleted the fix-responsable branch February 7, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: exception thrown when request being throttled
2 participants