refactor: unify error constructors to object params, add validationErrors - #1
Merged
Conversation
…rors
Replace inconsistent positional params (messageOverride, details, retryAfter)
with a uniform single-object signature { message?, cause?, details? } on all
error subclasses. AssemblyResponseParseError narrows cause to ZodError and
exposes validationErrors (z.prettifyError output) for human-readable output.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ions - AssemblyResponseParseError: replace `declare readonly cause: ZodError` (pure type assertion with no runtime presence) with an `override get cause()` getter that casts at the point of use — explicit, transparent, and safe - Destructure cause/details individually in the constructor instead of spreading ...rest, making the parameter flow explicit - Add JSDoc to AssemblyErrorOptions fields clarifying the message/cause/details contract and the optional-vs-required split between the public interface and the internal AssemblyBaseErrorInit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{ message?, cause?, details? }AssemblyResponseParseErrornarrowscausetoZodError(required) and drops the oldzodErrorfield — access via.causevalidationErrors: stringproperty usingz.prettifyError()(Zod 4 built-in) for human-readable issue outputAssemblyErrorOptions,AssemblyRateLimitErrorOptions,AssemblyResponseParseErrorOptions) from the public indexBefore / After
Before (inconsistent positional params):
After (uniform object):
Test plan
bun test— all 68 tests passbun run type-check— no type errorsbun run lint— no lint errors🤖 Generated with Claude Code