ITLab.Template.DevPack.Exceptions
Provides base exception types used by guard clauses and internal invariant enforcement.
Componentes
| Tipo | Nome | Responsabilidade |
|---|---|---|
| Class | GuardClauseException | Thrown when a guard clause detects an invalid precondition |
Como usar
// GuardClauseException is thrown by Ardalis.GuardClauses extensions internally.
// Products typically catch it at the pipeline boundary and translate to a Result.
Guard.Against.Null(value, nameof(value));
O que não fazer
- Do not throw
GuardClauseExceptiondirectly for expected application failures — returnResultinstead. - Do not catch
GuardClauseExceptionin domain or application layer handlers; let it propagate to the pipeline boundary.
Extensão pelo produto
- Products can register a global exception filter or middleware to translate
GuardClauseExceptioninto400 Bad Requestresponses.