Hi, I’m trying to use this model with an Int? Id:
[Route("/customers/{Id}", "GET")]
public class Customers
{
public int? Id { get; set; }
}
in this service:
var customers = Db.LoadSelect<Customer>(customer => customer.Where(c => c.Id == request.Id));
The problem is how I can handle the 500 error that rises when I pass a non-numeric Id value to the route.
There is a preferred way to do this? I have tried with:
this.ServiceExceptionHandlers.Add((httpReq, request, exception) => {
return DtoUtils.CreateErrorResponse(request, exception);
});
this.UncaughtExceptionHandlers.Add((req, res, operationName, ex) => {
res.Write("Error: {0}: {1}".Fmt(ex.GetType().Name, ex.Message));
res.EndRequest(skipHeaders: true);
});
but it seems doesn’t do anything… I have the same IIS 500 error page.