The SDK throws typed errors for different HTTP status codes. All errors extend SocialRouterError.

Error classes

Usage

Error properties

All error classes share these properties: RateLimitError has an additional property:

Self-correcting validation errors

400 and 404 bodies name the field, the expected shape, and the valid alternatives. An unknown service lists the platform’s services with a did-you-mean, an unknown offer lists the ones that serve the service, and an invalid option lists the allowed values. err.message carries that text verbatim, so an agent reading the thrown error has everything it needs to fix the call in one round trip.