Skip to content

Class: ValifetchError ​

Defined in: src/errors/ValifetchError.ts:49

Custom error class for valifetch errors Provides structured error information for better error handling

Extends ​

  • Error

Constructors ​

Constructor ​

new ValifetchError(options): ValifetchError

Defined in: src/errors/ValifetchError.ts:70

Constructs a ValifetchError.

Parameters ​

options ​

ValifetchErrorOptions

Error details: message, code, and optional request/response/validation/cause/responseBody context.

Returns ​

ValifetchError

Overrides ​

Error.constructor

Properties ​

cause? ​

optional cause?: unknown

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:24

Inherited from ​

Error.cause


code ​

readonly code: ErrorCode

Defined in: src/errors/ValifetchError.ts:51

Error code for discriminated error handling


message ​

message: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1075

Inherited from ​

Error.message


name ​

name: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1074

Inherited from ​

Error.name


request? ​

readonly optional request?: Request

Defined in: src/errors/ValifetchError.ts:53

Original request that caused the error


response? ​

readonly optional response?: Response

Defined in: src/errors/ValifetchError.ts:55

Response received (if any)


responseBody? ​

readonly optional responseBody?: unknown

Defined in: src/errors/ValifetchError.ts:64

Parsed response body on HTTP_ERROR (JSON-parsed object/array, or plain text when the body is not valid JSON) and raw text on PARSE_ERROR (the response body that failed to parse as JSON). undefined when the body could not be read at all.


stack? ​

optional stack?: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from ​

Error.stack


validation? ​

readonly optional validation?: ValidationErrorInfo

Defined in: src/errors/ValifetchError.ts:57

Validation error details (if validation failed)

Accessors ​

isAbortError ​

Get Signature ​

get isAbortError(): boolean

Defined in: src/errors/ValifetchError.ts:107

Check if this is an abort/cancel error

Returns ​

boolean


isHttpError ​

Get Signature ​

get isHttpError(): boolean

Defined in: src/errors/ValifetchError.ts:92

Check if this is an HTTP error (non-2xx status)

Returns ​

boolean


isNetworkError ​

Get Signature ​

get isNetworkError(): boolean

Defined in: src/errors/ValifetchError.ts:102

Check if this is a network error

Returns ​

boolean


isParseError ​

Get Signature ​

get isParseError(): boolean

Defined in: src/errors/ValifetchError.ts:112

Check if this is a parse error (e.g., invalid JSON)

Returns ​

boolean


issues ​

Get Signature ​

get issues(): BaseIssue<unknown>[]

Defined in: src/errors/ValifetchError.ts:117

Get flattened validation issues (convenience)

Returns ​

BaseIssue<unknown>[]


isTimeoutError ​

Get Signature ​

get isTimeoutError(): boolean

Defined in: src/errors/ValifetchError.ts:97

Check if this is a timeout error

Returns ​

boolean


isValidationError ​

Get Signature ​

get isValidationError(): boolean

Defined in: src/errors/ValifetchError.ts:87

Check if this is a validation error

Returns ​

boolean


status ​

Get Signature ​

get status(): number | undefined

Defined in: src/errors/ValifetchError.ts:127

HTTP status code (if available)

Returns ​

number | undefined


statusText ​

Get Signature ​

get statusText(): string | undefined

Defined in: src/errors/ValifetchError.ts:132

HTTP status text (if available)

Returns ​

string | undefined


target ​

Get Signature ​

get target(): ValidationTarget | undefined

Defined in: src/errors/ValifetchError.ts:122

Which part of the request/response failed validation (convenience)

Returns ​

ValidationTarget | undefined

Released under the MIT License. Built with Claude Code.