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

Error handler #13

Merged
merged 8 commits into from
Apr 20, 2023
Merged

Error handler #13

merged 8 commits into from
Apr 20, 2023

Conversation

Chemaclass
Copy link
Member

📚 Description

Right now there is no way to handle exceptions while a Route is being triggered.
We want to map a callable to be resolved when a particular exception occurs.

🔖 Changes

  • Rename MappingInterfaces to Bindings
  • Add Handlers which maps potential exceptions while running a Route which ends in an Exception
  • When ussing Router::configure(...) the order or the parameters from that callable doesn't matter

🧪 Example

# A
static function (Routes $routes, Bindings $bindings, Handlers $handlers) void { ...
# B
static function (Routes $routes, Handlers $handlers, Bindings $bindings) void { ...
# C
static function (Routes $routes, Handlers $handlers) void { ...
# D
static function (Routes $routes, Bindings $bindings) void { ...

Any order, any arguments. This works by using reflextion at the callable on run time and figuring out which types are you using on different position, so it will use them properly. Kudos to @Tito-Kati 🧠

@antonio-gg-dev antonio-gg-dev merged commit 55fc6d3 into main Apr 20, 2023
@antonio-gg-dev antonio-gg-dev deleted the error-handler branch April 20, 2023 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants