Skip to main content
The hydric Gateway SDK implements a robust error handling system using custom TypeScript classes. This allows you to differentiate between different failure types (like rate limits vs. validation errors) using standard instanceof checks.

Base Error Class

All custom errors in the SDK extend from HydricError. This base class provides:
  • name: The specific error name (e.g., HydricRateLimitError).
  • message: A human-readable explanation of what went wrong.

Common Error Types

Handling Errors

We recommend using a try/catch block with instanceof checks for precise error management.

Fail Fast & Loud

The SDK is designed to throw as soon as it detects an issue. For example, if a required parameter is missing, it will throw a HydricInvalidParamsError before even making the network request, saving you latency and API quota.