Skip to content

Polishing#9

Merged
johnpmitsch merged 4 commits into
mainfrom
polishing
Apr 21, 2026
Merged

Polishing#9
johnpmitsch merged 4 commits into
mainfrom
polishing

Conversation

@johnpmitsch

@johnpmitsch johnpmitsch commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Note

Medium Risk
Touches error propagation and exception surfaces across Rust, Python, Node, and Ruby; mistakes could change how failures are classified or break consumer error-handling expectations, though changes are localized to mapping/wrapper layers and examples.

Overview
Introduces a typed, cross-language error hierarchy for the SDK, expanding core SdkError handling with UrlParse/Config surfacing and a new HttpKind classifier (Timeout/Connect/Other) to consistently categorize transport failures.

Bindings are updated to map SdkError into language-native subclasses (Python/Ruby exception classes with status/body metadata; Node via tagged napi::Error messages parsed and rethrown by a new JS wrapper + Proxy that wraps all client methods). Documentation and examples across Rust/Python/Node/Ruby are updated to demonstrate catching specific errors, and small e2e/example tweaks adjust rate-limit/test timing behavior.

Reviewed by Cursor Bugbot for commit 11adbb4. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread npm/errors.js Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fb4e06a. Configure here.

Comment thread crates/node/src/errors.rs
} else {
"-".to_string()
};
let tagged = format!("[{kind}|{status_s}|{body_len}]{msg}\u{001f}{body_s}");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing \x1f control character in Node.js error messages

Medium Severity

The Rust format! on line 34 unconditionally appends \u{001f} (unit separator) even when body_s is empty (for Config, Http, Timeout, Connect variants). On the JS side, fromNapiError only strips the separator when bodyLenStr !== "-", so non-body error variants end up with a trailing \x1f control character in their .message. This pollutes user-facing error messages and can break string comparisons, JSON serialization, and log output.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fb4e06a. Configure here.

@johnpmitsch johnpmitsch merged commit 7af595c into main Apr 21, 2026
5 checks passed
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.

1 participant