Errors
All SDK errors extend BaseError, which extends HttpClientError from @http-client-toolkit/core. Every error includes a message and a help property with guidance for resolving the issue.
Error Classes
Section titled “Error Classes”UnauthorizedError
Section titled “UnauthorizedError”Thrown when the API key is invalid or missing.
import { UnauthorizedError } from 'comic-vine-sdk';
try { const issue = await client.issue.retrieve(1);} catch (error) { if (error instanceof UnauthorizedError) { console.error('Check your API key'); }}ObjectNotFoundError
Section titled “ObjectNotFoundError”Thrown when the requested resource does not exist.
import { ObjectNotFoundError } from 'comic-vine-sdk';
try { const issue = await client.issue.retrieve(999999);} catch (error) { if (error instanceof ObjectNotFoundError) { console.error('Resource not found'); }}FilterError
Section titled “FilterError”Thrown when the request contains invalid filter parameters.
import { FilterError } from 'comic-vine-sdk';
try { const issues = await client.issue.list({ filter: { invalid: 'field' } });} catch (error) { if (error instanceof FilterError) { console.error('Invalid filter:', error.message); }}GenericRequestError
Section titled “GenericRequestError”Thrown for general API request failures.
GenericError
Section titled “GenericError”Thrown for unexpected API errors that don’t match a specific error type.
SubscriberOnlyError
Section titled “SubscriberOnlyError”Thrown when accessing a resource that requires a subscriber account.
UrlFormatError
Section titled “UrlFormatError”Thrown when the constructed request URL is malformed.
JsonpCallbackMissingError
Section titled “JsonpCallbackMissingError”Thrown when a JSONP callback parameter is missing from the request.
OptionsValidationError
Section titled “OptionsValidationError”Thrown when the client configuration is invalid. This is a client-side validation error that occurs before any API call is made.
import { OptionsValidationError } from 'comic-vine-sdk';
try { const client = new ComicVine({ apiKey: '' });} catch (error) { if (error instanceof OptionsValidationError) { console.error('Invalid configuration:', error.message); }}Error Hierarchy
Section titled “Error Hierarchy”HttpClientError (@http-client-toolkit/core) └── BaseError ├── UnauthorizedError ├── ObjectNotFoundError ├── FilterError ├── GenericRequestError ├── GenericError ├── SubscriberOnlyError ├── UrlFormatError ├── JsonpCallbackMissingError └── OptionsValidationErrorCommon Error Properties
Section titled “Common Error Properties”| Property | Type | Description |
|---|---|---|
message | string | Error description |
help | string | Guidance for resolving the error |
name | string | Error class name |
stack | string | Stack trace |
See Also
Section titled “See Also”- Error Handling Guide — Patterns for handling errors