Formatter Exception Policy Enum
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines the set of policies that determine how the model binding system interprets exceptions thrown by an IInputFormatter.
public enum class InputFormatterExceptionPolicy
public enum InputFormatterExceptionPolicy
type InputFormatterExceptionPolicy =
Public Enum InputFormatterExceptionPolicy
This value indicates that all exceptions thrown by an IInputFormatter will be treated as model state errors.
This value indicates that only InputFormatterException and subclasses will be treated as model state errors. All other exceptions types will be re-thrown and can be handled by a higher level exception handler, such as exception-handling middleware.
An IInputFormatter could throw an exception for several reasons, including:
- malformed input
- client disconnect or other I/O problem
- application configuration problems such as TypeLoadException
The policy associated with AllExceptions treats all such categories of problems as model state errors, and usually will be reported to the client as an HTTP 400. This was the only policy supported by model binding in ASP.NET Core MVC 1.0, 1.1, and 2.0 and is still the default for historical reasons.
The policy associated with MalformedInputExceptions treats only InputFormatterException and its subclasses as model state errors. This means that exceptions that are not related to the content of the HTTP request (such as a disconnect) will be re-thrown, which by default would cause an HTTP 500 response, unless there is exception-handling middleware enabled.