-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add custom mapping from errors to views #23
Conversation
Codecov Report
@@ Coverage Diff @@
## main #23 +/- ##
==========================================
+ Coverage 96.61% 96.82% +0.21%
==========================================
Files 2 2
Lines 59 63 +4
==========================================
+ Hits 57 61 +4
Misses 2 2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whilst we can argue the merits of returning a 401 page instead of using the redirect middleware I think this PR has some useful features in. Some requested changes around the tests then we're good
Tests/LeafErrorMiddlewareTests/CustomMappingCustomGeneratorTests.swift
Outdated
Show resolved
Hide resolved
Tests/LeafErrorMiddlewareTests/CustomMappingCustomGeneratorTests.swift
Outdated
Show resolved
Hide resolved
Tests/LeafErrorMiddlewareTests/CustomMappingDefaultGeneratorTests.swift
Outdated
Show resolved
Hide resolved
@0xTim Bump. Wanna start using these features in my projects 😛 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Adds an optional parameter to
init
as well as theLeafMiddlewareDefaultGenerator
to provide a custom set of mappings ofHTTPStatus
to.leaf
template names. Does not break the public API. I did this because it didn't make sense to get a 503 page when someone messes up their password.