Skip to content

Error Handling

The SDK throws DripsError instances for all SDK-related failures. These errors extend the standard JavaScript Error class with additional context information.

DripsError Properties

PropertyTypeDescription
messagestringError message prefixed with [Drips SDK]
namestringAlways "DripsError"
causeunknownThe underlying error that caused this failure (if any)
metaDripsErrorMetaAdditional context about the error, including operation details

Example Usage

import { DripsError } from '@drips-network/sdk';
 
try {
  const result = await sdk.dripLists.getDripListById('123');
} catch (error) {
  if (error instanceof DripsError) {
    console.error('SDK Error:', error.message);
    console.error('Operation:', error.meta?.operation);
    console.error('Context:', error.meta);
    console.error('Underlying cause:', error.cause);
  }
}