Given this basic GET method:
public Foo Get([FromQuery][MaxLength(int.MaxValue, ErrorMessage ="Custom error message")] int input)
{
// DO THINGS
}
The MaxLength decorator is not working when I actually send a value bigger than int.MaxValue:
https://apiurl/foo?input=9999999999999999999
I get a System.OverflowException: 'Value was either too large or too small for an Int32.', way before it reaches the MaxLength validator, in System.Private.CoreLib
Is there an easy way to handle this error and actually return my custom Error Message or do I have to implement a custom ModelBinder?