mehdi-fathi / eloquent-filter

Eloquent Filter is a package for filter data of models by the query strings. Easy to use and fully dynamic.
https://mehdi-fathi.github.io/eloquent-filter/
MIT License
430 stars 43 forks source link

Use custom exceptions for better error handling #175

Closed MirazMac closed 2 years ago

MirazMac commented 2 years ago

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 commented 2 years ago

@MirazMac

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

Thanks

MirazMac commented 2 years ago

Thanks a lot.

mehdi-fathi commented 2 years ago

@MirazMac Please upgrade the package to 2.5.4

MirazMac commented 2 years ago

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