PreconditionRequiredException Class
Definition
- Namespace
- Cuemon.AspNetCore.Http
- Assemblies
- Cuemon.AspNetCore.dll
The exception that is thrown when the origin server requires the request to be conditional.
public class PreconditionRequiredException : HttpStatusCodeException, ISerializable
- Inheritance
-
objectPreconditionRequiredException
- 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
| Name | Description |
|---|---|
| PreconditionRequiredException() | Initializes a new instance of the PreconditionRequiredException class. |
| PreconditionRequiredException(Exception) | Initializes a new instance of the PreconditionRequiredException class. |
| PreconditionRequiredException(string, Exception) | Initializes a new instance of the PreconditionRequiredException class. |