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

Use custom exceptions for better error handling #175

Closed
MirazMac opened this issue Jul 24, 2021 · 4 comments
Closed

Use custom exceptions for better error handling #175

MirazMac opened this issue Jul 24, 2021 · 4 comments

Comments

@MirazMac
Copy link

Is your feature request related to a problem? Please describe.
The package often throws exception which is very good for error handling and debugging. But catching or handling those exceptions are kind of problematic. Since the package only throws \Exception, it's hard to catch them by their specific name as all exceptions extend this base Exception class.
So it would be good if those exceptions were custom made.

Describe the solution you'd like
Create and throw custom exception classes that extend the base \Exception class. For example, EloquentFilterException etc. So, one can simply do this:

try {
//...
} catch (\eloquentFilter\Exceptions\EloquentFilterException $e) {
} catch(\AnyOtherException $e) {
}

Thanks.

Describe alternatives you've considered

Additional context

@mehdi-fathi
Copy link
Owner

@MirazMac

Good, suggest. I'll investigate this feature in the later version.

Thanks

@MirazMac
Copy link
Author

Thanks a lot.

@mehdi-fathi
Copy link
Owner

@MirazMac Please upgrade the package to 2.5.4

@MirazMac
Copy link
Author

I just did, thanks a lot for such quick action.

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