| Clean Architecture Toolkit for .NET | |||||
|
Clean Architecture Toolkit is a clean, modular architecture foundation for .NET applications. It embraces SOLID principles and focuses on maintainability, testability, and scalability through clear boundaries and pluggable design. |
|
||||
|
| HOME | MODULE OVERVIEW | DEMO | |
|||||
Plans for Cat.Responses
Open question for the existing Cat.Responses module and its users: how do we name error codes?
Status: not started. Cat.Responses itself exists. This plan collects what we know. The open questions need an answer before the build.
Contents
The idea
Every failed response carries errors with a stable code. Clients match on the code, not on the text. The modules define codes and the demo services define their own, and so far nothing says how a service should choose a prefix. A clear convention keeps codes unique and tells a developer what to do.
What we already know
From the module readmes:
Cat.Validatorsuses the prefixCAT-VAL-and says to give your own codes a prefix of your own, likeAPP-, so they do not clash withCAT-VAL-orCAT-GEN-.Cat.ServiceRequestsreturnsCAT-GEN-1001for an unexpected response.Cat.Responseshas the failed typesBadRequest,Unauthorized,Forbidden,NotFound,ConflictandInternalServerError.Cat.Minimal.ApishowsCAT-DEM-1000as an example code in its readme.
From the demo:
- Catalog uses the prefix
CAT-CTL-inCatalogErrorDefinitions. - Orders uses the prefix
CAT-ORD-inOrderErrorDefinitions. - Both demo prefixes start with
CAT-, the same start as the module codes. This is the opposite of the advice in theCat.Validatorsreadme.
Decisions and open questions
Decided
| Topic | Decision |
|---|---|
| Advice for your own codes | Use a prefix of your own, as the Cat.Validators readme says. Module codes use CAT- with a short area name. |
Open
- The demo prefixes. Keep
CAT-CTL-andCAT-ORD-, or change them to a prefix that is notCAT-? Keeping them is simple. Changing them makes the demo follow its own advice. - A convention. A pattern such as
<PREFIX>-<AREA>-<number>, and a number range for each kind of error. - A registry. A list of the codes of every module in one place, for example in the
Cat.Responsesreadme. - A helper. A small base class for error definitions, since both demo services repeat the same shape.
- Message text. Do codes go with localized messages through
Cat.Localizations? See Cat.Localizations.md.
Questions before building
- Do the demo services keep the
CAT-prefix, or switch to their own? - Do we write down a code convention in the
Cat.Responsesreadme? - Do we want a registry of all module codes?
- Is a base class for error definitions worth adding?