Table of Contents

Class Error.NotFound

Namespace
Trellis
Assembly
Trellis.Core.dll

The requested resource does not exist.

public sealed record Error.NotFound : Error, IEquatable<Error>, IEquatable<Error.NotFound>
Inheritance
Error.NotFound
Implements
Inherited Members
Extension Methods

Constructors

NotFound(ResourceRef)

The requested resource does not exist.

public NotFound(ResourceRef Resource)

Parameters

Resource ResourceRef

The resource that was looked up.

Properties

Kind

Gets the stable domain slug for this case (e.g. "not-found", "invalid-input"). Suitable for telemetry, observability dimensions, and as the durable identifier that boundary layers translate into transport-specific type identifiers.

public override string Kind { get; }

Property Value

string

Resource

The resource that was looked up.

public ResourceRef Resource { get; init; }

Property Value

ResourceRef

Methods

For(string?, ResourceRef, string?)

Convenience factory that builds a Error.NotFound from an explicit resource reference.

public static Error.NotFound For(string? code, ResourceRef resource, string? detail = null)

Parameters

code string

Optional stable reason code naming why the resource is absent. Omitted, empty, or whitespace leaves the inherited Unspecified sentinel.

resource ResourceRef

The addressed resource.

detail string

Optional human-readable detail.

Returns

Error.NotFound

A Error.NotFound wrapping the resource reference.

For(ResourceRef, string?)

Creates a not-found error without a finer reason code.

public static Error.NotFound For(ResourceRef resource, string? detail = null)

Parameters

resource ResourceRef

The addressed resource.

detail string

Optional human-readable detail.

Returns

Error.NotFound

A Error.NotFound with the unspecified code.

For<TResource>(string?, object?, string?)

Convenience factory that builds a Error.NotFound for the resource type TResource (its CLR name becomes the resource name).

public static Error.NotFound For<TResource>(string? code = null, object? id = null, string? detail = null)

Parameters

code string

Optional stable reason code naming why the resource is absent — e.g. "order.not-found" (no such row) versus "order.archived" (deliberately withheld), which share the 404 surface but are not the same answer to a client. Omitted, empty, or whitespace leaves the inherited Unspecified sentinel, so an empty string never reaches the wire.

id object

Optional identifier of the specific instance; omit for a collection-level lookup.

detail string

Optional human-readable detail.

Returns

Error.NotFound

A Error.NotFound wrapping the resource reference.

Type Parameters

TResource

The resource type whose name identifies the resource.