public object GetExamples()
 => new ProblemDetails
 {
     HttpStatus         = StatusCodes.Status404NotFound,
     Title              = ProblemDetails.DefaultTitle,
     Detail             = Message,
     ProblemInstanceUri = ProblemDetails.GetProblemNumber()
 };
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)
 };
Exemplo n.º 6
0
        public override ProblemDetails MapException(ApiProblemDetailsException exception, ProblemDetailsHelper problemDetailsHelper)
        {
            var registryName = ((GoneException)exception).RegistryName;

            return(new ProblemDetails
            {
                ProblemTypeUri = $"urn:be.vlaanderen.basisregisters.api:{registryName}:gone",
                HttpStatus = StatusCodes.Status410Gone,
                Title = ProblemDetails.DefaultTitle,
                Detail = exception?.Message,
                ProblemInstanceUri = $"{problemDetailsHelper.GetInstanceBaseUri()}/{ProblemDetails.GetProblemNumber()}"
            });
        }
Exemplo n.º 7
0
        public override ProblemDetails MapException(
            ApiProblemDetailsException exception,
            ProblemDetailsHelper problemDetailsHelper)
        {
            var registryName = ((PreconditionFailedException)exception).RegistryName;

            return(new ProblemDetails
            {
                HttpStatus = StatusCodes.Status412PreconditionFailed,
                Title = ProblemDetails.DefaultTitle,
                Detail = "De If-Match header komt niet overeen met de laatst gekende ETag.",
                ProblemTypeUri = $"urn:be.vlaanderen.basisregisters.api:{registryName}:precondition-failed",
                ProblemInstanceUri = $"{problemDetailsHelper.GetInstanceBaseUri()}/{ProblemDetails.GetProblemNumber()}"
            });
        }