Table of Contents

GoneException Class

Definition

Namespace
Cuemon.AspNetCore.Http
Assemblies
Cuemon.AspNetCore.dll
Source
src/Cuemon.AspNetCore/Http/GoneException.cs

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.

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

GoneExceptionExample.Demonstrate();

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

Name Description
GoneException()

Initializes a new instance of the GoneException class.

GoneException(Exception)

Initializes a new instance of the GoneException class.

GoneException(string, Exception)

Initializes a new instance of the GoneException class.

See Also