Current error design mixes semantic errors ("no such content folder", "duplicate torrent ID") with transient/global errors ("IO error", "DB error"). There's a few limitations:
- using snafu, we need to provide a string representation for the error
- but can't translate the error in different languages
- can't really distinguish where unwrapping makes sense or not
We could use a pattern like:
- more liberal use of unwraps (eg. for DB IO) with a panic catching middleware to display an "internal server error" because DB errors should not happen
- global, unrecoverable errors are still expressed as
AppStateError and displayed full page
- maybe templates have more specific error types?
Maybe we'd want AppStateError to be serializable to a cookie, which excludes IO errors (among others), for helping with FlashRedirect.
Current error design mixes semantic errors ("no such content folder", "duplicate torrent ID") with transient/global errors ("IO error", "DB error"). There's a few limitations:
We could use a pattern like:
AppStateErrorand displayed full pageMaybe we'd want
AppStateErrorto be serializable to a cookie, which excludes IO errors (among others), for helping withFlashRedirect.