Table of Contents

PreconditionRequiredException Class

Definition

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.

// Program.cs
using System;
using Cuemon.AspNetCore.Http;

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.

See Also