Class PreconditionRequiredException
- Namespace
- Cuemon.AspNetCore.Http
- Assembly
- Cuemon.AspNetCore.dll
The exception that is thrown when the origin server requires the request to be conditional.
public class PreconditionRequiredException : HttpStatusCodeException, ISerializable
- Inheritance
-
PreconditionRequiredException
- Implements
- Inherited Members
Examples
The following example demonstrates how to use PreconditionRequiredException when a request requires conditional headers.
using System;
namespace Cuemon.AspNetCore.Http;
public static class PreconditionRequiredExceptionExample
{
public static void Demonstrate()
{
var hasConditionHeader = false;
var exception = hasConditionHeader
? new PreconditionRequiredException()
: new PreconditionRequiredException("Supply an If-Match header before retrying the update.");
Console.WriteLine(exception.Message);
Console.WriteLine(exception.StatusCode);
}
}
Constructors
PreconditionRequiredException()
Initializes a new instance of the PreconditionRequiredException class.
public PreconditionRequiredException()
PreconditionRequiredException(Exception)
Initializes a new instance of the PreconditionRequiredException class.
public PreconditionRequiredException(Exception innerException)
Parameters
innerExceptionExceptionThe exception that is the cause of the current exception.
PreconditionRequiredException(string, Exception)
Initializes a new instance of the PreconditionRequiredException class.
public PreconditionRequiredException(string message, Exception innerException = null)
Parameters
messagestringThe message that describes the HTTP status code.
innerExceptionExceptionThe exception that is the cause of the current exception.