Pular para o conteúdo principal
Versão: 10.4.1

ITLab.Template.DevPack.Exceptions

Provides base exception types used by guard clauses and internal invariant enforcement.

Componentes

TipoNomeResponsabilidade
ClassGuardClauseExceptionThrown 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 GuardClauseException directly for expected application failures — return Result instead.
  • Do not catch GuardClauseException in 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 GuardClauseException into 400 Bad Request responses.