Skip to main content

Class: NotFoundError

Defined in: src/types/errors.ts:160

Resource not found error.

Remarks

Thrown when a requested resource does not exist in the AppView index.

This error does NOT mean the resource doesn't exist in the AT Protocol network; it may exist in a user's PDS but not be indexed by Chive.

HTTP mapping: 404 Not Found

Example

const eprint = await storage.getEprint(uri);
if (!eprint) {
throw new NotFoundError('Eprint', uri);
}

Extends

Constructors

new NotFoundError()

new NotFoundError(resourceType, resourceId): NotFoundError

Defined in: src/types/errors.ts:183

Creates a new NotFoundError.

Parameters

resourceType

string

Type of resource (e.g., 'Eprint', 'Author')

resourceId

string

Resource identifier (e.g., AT URI, DID)

Returns

NotFoundError

Overrides

ChiveError.constructor

Properties

cause?

readonly optional cause: Error

Defined in: src/types/errors.ts:71

Original error that caused this error (if any).

Remarks

Error chaining allows tracking the full error context through multiple layers of the application. Useful for debugging complex error scenarios.

Example

try {
await fetchData();
} catch (err) {
throw new ValidationError('Failed to validate data', 'field', 'required', err as Error);
}

Inherited from

ChiveError.cause


code

readonly code: "NOT_FOUND" = 'NOT_FOUND'

Defined in: src/types/errors.ts:161

Machine-readable error code.

Remarks

Error codes are unique identifiers for error types, enabling programmatic error handling (switch statements, error maps), error tracking in monitoring systems, and client-side error translation (i18n).

Overrides

ChiveError.code


resourceId

readonly resourceId: string

Defined in: src/types/errors.ts:175

Identifier of the resource that was not found.

Example

AT URI, DID, field ID

resourceType

readonly resourceType: string

Defined in: src/types/errors.ts:168

Type of resource that was not found.

Example

'Eprint', 'Review', 'Author', 'Field'