t10d/kingdom-python-server

Improve error handling

ruiconti opened this issue · 0 comments

Issue

Error handlings are somewhat awkward as they're being dealt in more than one place (service and presentation layers). This violates SPOT rule, which states that in a good design every piece of knowledge must have a single, unambiguous, authoritative representation [ref]. It's also known as "Single source of truth" rule.

Proposed solution

sobolevn has proposed an elegant solution that resembles how Rust handles errors. And it is indeed really neat and clean.
It can be a good starters as this implementation may be aware of how it should represent itself in function of which layer it is in.