Skip to content

feat: Add a common Seam::Error base for SDK errors - #585

Open
razor-x wants to merge 1 commit into
mainfrom
claude/ruby-sdk-audit-xbhaia-base-error
Open

feat: Add a common Seam::Error base for SDK errors#585
razor-x wants to merge 1 commit into
mainfrom
claude/ruby-sdk-audit-xbhaia-base-error

Conversation

@razor-x

@razor-x razor-x commented Sep 1, 2026

Copy link
Copy Markdown
Member

Problem

Every error the ruby SDK raises descended directly from StandardError (Http::ApiError, ActionAttemptError, SeamInvalidOptionsError, SeamInvalidTokenError, UnserializableParamError), so a caller could not rescue everything the SDK raises in one clause. The python (seamapi/python#634, SeamError) and PHP (SeamException) waves made that promise true; ruby could not.

Change

New Seam::Error < StandardError in lib/seam/errors.rb; the five existing error roots subclass it. Non-breaking: StandardError remains an ancestor of all of them. Seam::WebhookVerificationError stays Svix's own class, as the README documents. README's Error Handling section opens with the one-rescue promise.

When #574 (Seam::Http::InvalidResponseError) and #578 (Seam::InvalidWebhookPayloadError) land, this PR will be updated to reparent those two as well, so it should merge last.

Tests

New spec/seam_error_spec.rb asserts every SDK error class is a Seam::Error, that the svix error is not, and that an option error raised by the client is rescued as Seam::Error.

Revert-check against main: 10 failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SQW83gyXeUG61RDrHEky97


Generated by Claude Code

Every error the SDK raised descended directly from StandardError, so a
caller could not rescue everything the SDK raises in one clause the way
the other Seam SDKs allow. Add Seam::Error and make the API, option,
token, action attempt, and serialization errors subclass it. Svix's
verification error stays Svix's own class, as documented.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SQW83gyXeUG61RDrHEky97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants