ExceptionResult Class

An action result that returns a Microsoft.AspNetCore.Http.StatusCodes.Status500InternalServerError response and performs content negotiation on an System.Web.Http.HttpError based on an System.Web.Http.ExceptionResult.Exception.

Namespace
System.Web.Http
Assemblies
  • Microsoft.AspNetCore.Mvc.WebApiCompatShim

Syntax

public class ExceptionResult : ObjectResult, IActionResult
class System.Web.Http.ExceptionResult

Constructors

ExceptionResult(System.Exception, System.Boolean)

Initializes a new instance of the System.Web.Http.ExceptionResult class.

Arguments:
  • exception (System.Exception) – The exception to include in the error.
  • includeErrorDetail (System.Boolean) – <xref uid=”langword_csharp_true” name=”true” href=”“></xref> if the error should include exception messages; otherwise, <xref uid=”langword_csharp_false” name=”false” href=”“></xref>.
public ExceptionResult(Exception exception, bool includeErrorDetail)

Properties

System.Web.Http.ExceptionResult.Exception

Gets the exception to include in the error.

Return type:System.Exception
public Exception Exception { get; }
System.Web.Http.ExceptionResult.IncludeErrorDetail

Gets a value indicating whether the error should include exception messages.

Return type:System.Boolean
public bool IncludeErrorDetail { get; }

Methods

ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext)
Return type:System.Threading.Tasks.Task
public override Task ExecuteResultAsync(ActionContext context)