You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our controllers throw APIErrorException for errors and a global exception handler to return a suitable HTTP status code. A consequence of this arrangement is that all non-200 status codes (e.g. "Not Found") are recorded in the console log as an unhandled exception. If we turn on logging, this will result in a log entry for every attempt to retrieve a non-existent value.
Our controllers throw
APIErrorException
for errors and a global exception handler to return a suitable HTTP status code. A consequence of this arrangement is that all non-200 status codes (e.g. "Not Found") are recorded in the console log as an unhandled exception. If we turn on logging, this will result in a log entry for every attempt to retrieve a non-existent value.Starting with ASP.NET Core 2.1, it is now possible to wrap the return type in an
ActionResult<T>
and report the status code without throwing an exception. (For asynchronous code, this may be wrapped in aTask<T>
.)Example
Resources:
ActionResult<T>
ActionResult<TValue>
ClassNotFound()
,Ok()
and other convenience methods are part ofControllerBase
Prerequisites
Sub-Tasks
Notes
The text was updated successfully, but these errors were encountered: