Skip to main content

Class: InvalidParameterError

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

The server rejected the request's parameters (e.g. HTTP 400 / 422 from the PFF API, or NFL Pro's empty-body 200). Not a fetch failure and not "no data": the call as made can never succeed — fix the arguments. (sdv-py raises ValueError.)

Example​

import sdv, { InvalidParameterError } from 'sportsdataverse';

try {
await sdv.nfl.pffApiTeamStats({ league: 'nfl', season: 'not-a-season' });
} catch (err) {
if (err instanceof InvalidParameterError) console.error(err.status, err.message); // 400 / 422
else throw err;
}

Remarks​

request() throws it for HTTP 400 / 422 without retrying; a family's classifyError (see registerFamilyDefaults) may also return one for a 2xx with an empty body.

Extends​

Constructors​

Constructor​

new InvalidParameterError(message, details): InvalidParameterError

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

Parameters​

message​

string

Message naming the family, host / path, status and a body excerpt, redacted.

details​

FetchErrorDetails

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

Returns​

InvalidParameterError

Overrides​

SdvError.constructor

Properties​

status?​

readonly optional status?: number

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

HTTP status (400 / 422, or 200 when a family classified an empty body).


url​

readonly url: string

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

Request URL, without the query string.