Table of Contents

Class GoneException

Namespace
Cuemon.AspNetCore.Http
Assembly
Cuemon.AspNetCore.dll

The exception that is thrown when the requested content has been permanently deleted from server, with no forwarding address.

public class GoneException : HttpStatusCodeException, ISerializable
Inheritance
GoneException
Implements
Inherited Members

Examples

The following example demonstrates how to return a GoneException from a deprecated API endpoint that has been removed.

using System;

namespace Cuemon.AspNetCore.Http;

public static class GoneExceptionExample
{
    public static void Demonstrate()
    {
        var exception = CreateArchivedEndpointException("/v1/orders");

        Console.WriteLine(exception.Message);
        Console.WriteLine(exception.StatusCode);
    }

    private static GoneException CreateArchivedEndpointException(string route)
    {
        return new GoneException($"The resource at '{route}' has been retired.");
    }
}

Constructors

GoneException()

Initializes a new instance of the GoneException class.

public GoneException()

GoneException(Exception)

Initializes a new instance of the GoneException class.

public GoneException(Exception innerException)

Parameters

innerException Exception

The exception that is the cause of the current exception.

GoneException(string, Exception)

Initializes a new instance of the GoneException class.

public GoneException(string message, Exception innerException = null)

Parameters

message string

The message that describes the HTTP status code.

innerException Exception

The exception that is the cause of the current exception.

See Also