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

Exception from other package #131

Closed
jurtjee1997 opened this issue Jan 18, 2019 · 2 comments
Closed

Exception from other package #131

jurtjee1997 opened this issue Jan 18, 2019 · 2 comments

Comments

@jurtjee1997
Copy link

I'm using the cartalyst-stripe , but when i get a exception it isn't transformd into this responder.

How can I fix it properly?

@flugg
Copy link
Owner

flugg commented Jan 21, 2019

Only exceptions that extend from the package's HttpException will be transformed into a correctly formatted error response. The package already converts most of Laravel's built-in exceptions to a package exception. If you want to do the same with other exceptions you can convert the exception in the exception handler to your own version extending HttpException:

$this->convert($exception, [
    CartalystException::class => MyCustomException::class
];

More information about converting exceptions can be found here: https://github.com/flugger/laravel-responder#handling-exceptions

Alternatively, you can catch the exception and do a regular responder->error('cartalys_error')->respond() to return an error message.

Hope this answers your question :)

@flugg
Copy link
Owner

flugg commented Jan 30, 2019

Did you end up solving this?

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

No branches or pull requests

2 participants