feat(domain): Rubro entity + domain exceptions (CAT-001)
This commit is contained in:
@@ -169,6 +169,79 @@ public sealed class ExceptionFilter : IExceptionFilter
|
||||
context.ExceptionHandled = true;
|
||||
break;
|
||||
|
||||
// CAT-001: Rubro exceptions
|
||||
case RubroNotFoundException rubroNotFoundEx:
|
||||
context.Result = new ObjectResult(new
|
||||
{
|
||||
error = "rubro_not_found",
|
||||
message = rubroNotFoundEx.Message
|
||||
})
|
||||
{
|
||||
StatusCode = StatusCodes.Status404NotFound
|
||||
};
|
||||
context.ExceptionHandled = true;
|
||||
break;
|
||||
|
||||
case RubroNombreDuplicadoEnPadreException rubroDupEx:
|
||||
context.Result = new ObjectResult(new
|
||||
{
|
||||
error = "rubro_nombre_duplicado",
|
||||
message = rubroDupEx.Message
|
||||
})
|
||||
{
|
||||
StatusCode = StatusCodes.Status409Conflict
|
||||
};
|
||||
context.ExceptionHandled = true;
|
||||
break;
|
||||
|
||||
case RubroTieneHijosActivosException rubroHijosEx:
|
||||
context.Result = new ObjectResult(new
|
||||
{
|
||||
error = "rubro_tiene_hijos_activos",
|
||||
message = rubroHijosEx.Message
|
||||
})
|
||||
{
|
||||
StatusCode = StatusCodes.Status409Conflict
|
||||
};
|
||||
context.ExceptionHandled = true;
|
||||
break;
|
||||
|
||||
case RubroPadreInactivoException rubroPadreEx:
|
||||
context.Result = new ObjectResult(new
|
||||
{
|
||||
error = "rubro_padre_inactivo",
|
||||
message = rubroPadreEx.Message
|
||||
})
|
||||
{
|
||||
StatusCode = StatusCodes.Status400BadRequest
|
||||
};
|
||||
context.ExceptionHandled = true;
|
||||
break;
|
||||
|
||||
case RubroMaxDepthExceededException rubroDepthEx:
|
||||
context.Result = new ObjectResult(new
|
||||
{
|
||||
error = "rubro_max_depth_exceeded",
|
||||
message = rubroDepthEx.Message
|
||||
})
|
||||
{
|
||||
StatusCode = StatusCodes.Status422UnprocessableEntity
|
||||
};
|
||||
context.ExceptionHandled = true;
|
||||
break;
|
||||
|
||||
case RubroCycleDetectedException rubroCycleEx:
|
||||
context.Result = new ObjectResult(new
|
||||
{
|
||||
error = "rubro_cycle_detected",
|
||||
message = rubroCycleEx.Message
|
||||
})
|
||||
{
|
||||
StatusCode = StatusCodes.Status400BadRequest
|
||||
};
|
||||
context.ExceptionHandled = true;
|
||||
break;
|
||||
|
||||
// ADM-001: Medio exceptions
|
||||
case MedioCodigoDuplicadoException medioCodDupEx:
|
||||
context.Result = new ObjectResult(new
|
||||
|
||||
Reference in New Issue
Block a user