Aller au contenu principal

HTTPError

Index

Constructor

InvalidURL

  • InvalidURL constructor

readonlycreate

create: (...properties: [properties: ParametersProperties<InvalidURL>]) => InvalidURL

Return a new CustomError

@example
const MyError = CustomError.define('MyError1');
const error = MyError.create({
message: 'my custom message', // customize message (optional)
cause: parentError, // Error that caused this error (optional)
})

readonlyerrorName

errorName: HTTPInvalidURLError

The model name constant. Can be useful for switch / case statements.

@example
const error: SomeError;
switch (error.name) {
case SomeError.errorName: //...
}

readonlyhasInstance

hasInstance: (anyValue: unknown) => anyValue is InvalidURL

Predicate that returns true when anyValue is a Model The implementation compares anyValue.name === Module.errorName

@example
const MyError = CustomError.define('MyError1');
const unknownError: unknown;
if (MyError.hasInstance(unknownError)) {
// unknownError.name === 'MyError1'
}

NetworkError

  • NetworkError constructor

readonlycreate

create: (...properties: [properties?: ParametersProperties<NetworkError>]) => NetworkError

Return a new CustomError

@example
const MyError = CustomError.define('MyError1');
const error = MyError.create({
message: 'my custom message', // customize message (optional)
cause: parentError, // Error that caused this error (optional)
})

readonlyerrorName

errorName: HTTPNetworkError

The model name constant. Can be useful for switch / case statements.

@example
const error: SomeError;
switch (error.name) {
case SomeError.errorName: //...
}

readonlyhasInstance

hasInstance: (anyValue: unknown) => anyValue is NetworkError

Predicate that returns true when anyValue is a Model The implementation compares anyValue.name === Module.errorName

@example
const MyError = CustomError.define('MyError1');
const unknownError: unknown;
if (MyError.hasInstance(unknownError)) {
// unknownError.name === 'MyError1'
}

ParserError

  • ParserError constructor

readonlycreate

create: (...properties: [properties?: ParametersProperties<ParserError>]) => ParserError

Return a new CustomError

@example
const MyError = CustomError.define('MyError1');
const error = MyError.create({
message: 'my custom message', // customize message (optional)
cause: parentError, // Error that caused this error (optional)
})

readonlyerrorName

errorName: HTTPParserError

The model name constant. Can be useful for switch / case statements.

@example
const error: SomeError;
switch (error.name) {
case SomeError.errorName: //...
}

readonlyhasInstance

hasInstance: (anyValue: unknown) => anyValue is ParserError

Predicate that returns true when anyValue is a Model The implementation compares anyValue.name === Module.errorName

@example
const MyError = CustomError.define('MyError1');
const unknownError: unknown;
if (MyError.hasInstance(unknownError)) {
// unknownError.name === 'MyError1'
}

Other

InvalidURL

InvalidURL:

An error when url passed is invalid

readonlyinput

input: string

NetworkError

NetworkError:

A network error when fetch fails

ParserError

ParserError:

A parsing error when the body cannot be parsed

Page Options