Skip to main content

Class: NoDataError

Defined in: src/core/errors.ts:248

The fetch succeeded and there is nothing there (HTTP 404, ESPN { code: 404 }).

Example​

import sdv, { NoDataError } from 'sportsdataverse';

try {
await sdv.nfl.espnNflSummary({ event: 1 });
} catch (err) {
if (err instanceof NoDataError) return []; // skip: a season gap, not a failure
throw err;
}

Remarks​

Sibling of AssetFetchError, never its parent or child: catching one never catches the other. NoESPNDataError is a back-compat alias of this class.

Extends​

Constructors​

Constructor​

new NoDataError(message, details): NoDataError

Defined in: src/core/errors.ts:257

Parameters​

message​

string

Message naming the family and the resource ("site_v2: HTTP 404: …").

details​

FetchErrorDetails

url (query-free), optional status and cause (FetchErrorDetails).

Returns​

NoDataError

Overrides​

SdvError.constructor

Properties​

status?​

readonly optional status?: number

Defined in: src/core/errors.ts:252

HTTP status when a response was received (404, or 200 for ESPN's { code: 404 } body).


url​

readonly url: string

Defined in: src/core/errors.ts:250

Request URL, without the query string.