protected override ProblemDetails GetApiProblemFor(ExampleRegistryException exception) =>
 new ProblemDetails
 {
     HttpStatus     = StatusCodes.Status400BadRequest,
     Title          = ProblemDetails.DefaultTitle,
     Detail         = exception.Message,
     ProblemTypeUri = ProblemDetails.GetTypeUriFor(exception)
 };
Exemplo n.º 2
0
 protected override ProblemDetails GetApiProblemFor(DomainException exception)
 => new ProblemDetails
 {
     HttpStatus         = StatusCodes.Status400BadRequest,
     Title              = Constants.DefaultTitle,
     Detail             = exception.Message,
     ProblemInstanceUri = ProblemDetails.GetProblemNumber(),
     ProblemTypeUri     = ProblemDetails.GetTypeUriFor(exception)
 };
 // TODO: When WrongExpectedVersionException has properties for stream and expected version,
 // we can turn this into a more detailed message
 protected override ProblemDetails GetApiProblemFor(WrongExpectedVersionException exception)
 => new ProblemDetails
 {
     HttpStatus         = StatusCodes.Status400BadRequest,
     Title              = "This action is not valid!",
     Detail             = exception.Message,
     ProblemInstanceUri = ProblemDetails.GetProblemNumber(),
     ProblemTypeUri     = ProblemDetails.GetTypeUriFor(exception)
 };
Exemplo n.º 4
0
 protected override ProblemDetails GetApiProblemFor(AggregateNotFoundException exception)
 => new ProblemDetails
 {
     HttpStatus         = StatusCodes.Status400BadRequest,
     Title              = "This action is not valid!",
     Detail             = $"The resource with id '{exception.Identifier}' does not exist.",
     ProblemInstanceUri = ProblemDetails.GetProblemNumber(),
     ProblemTypeUri     = ProblemDetails.GetTypeUriFor(exception)
 };
 protected override ProblemDetails GetApiProblemFor(InvalidServiceTypeException exception)
 => new ProblemDetails
 {
     HttpStatus         = StatusCodes.Status400BadRequest,
     Title              = Constants.DefaultTitle,
     Detail             = $"'{exception.Value}' is not valid for {exception.Type}.",
     ProblemInstanceUri = ProblemDetails.GetProblemNumber(),
     ProblemTypeUri     = ProblemDetails.GetTypeUriFor(exception)
 };
        protected override ProblemDetails GetApiProblemFor(CrabClientValidationException exception)
        {
            var validationErrors = exception
                                   .ValidationErrors
                                   .ToDictionary(
                key => key.ValidationErrorType,
                value => new [] { value.ValidationMessage });

            return(new ValidationProblemDetails
            {
                HttpStatus = StatusCodes.Status400BadRequest,
                Title = ProblemDetails.DefaultTitle,
                ProblemTypeUri = ProblemDetails.GetTypeUriFor(exception),
                Detail = "Fout bij de bron.",
                ValidationErrors = validationErrors
            });
        }