refactor: Separate StatusCookie and OperationStatus#37
Merged
Conversation
angrynode
commented
Feb 23, 2026
angrynode
commented
Feb 23, 2026
angrynode
commented
Feb 23, 2026
| <p class="mb-0">{{ flash.message }}</p> | ||
| {% for message in flash.message.messages() %} | ||
| <p class="mb-0">{{ message }}</p> | ||
| {% endfor %} |
Owner
Author
There was a problem hiding this comment.
Is that a proper display for nested errors?
b34a53b to
c363b8f
Compare
c363b8f to
c21c875
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here i try to make error reporting more flexible:
OperationStatuscan contain a stringy message or a typed errorOperationStatuserror sources will be flattened into a list of strings for display (maybe that's not the best approach but that's already what we're doing forAppStateError)StatusCookiecan be extracted directly in route handlers to display the error withStatusCookie::with_templatefor any template that implementsFallibleTemplate(to set the status in the template)CookieJarshould be extracted from the route then useStatusCookie::errororStatusCookie::success, then you can produce the redirect withStatusCookie::redirectFlashRedirectandFlashTemplate<Template>Not sure if that's the best approach in the long run (eg. for i18n) but for now that should make it easier:
OperationStatusthat's not based on a cookie (useful for feat: Start supporting magnet upload #17)