Repository navigation
fix: throw SdkError for invalid arguments - #289
Conversation
🦋 Changeset detectedLatest commit: 950addc The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Coverage report
Test suite run success132 tests passing in 30 suites. Report generated by 🧪jest coverage report action from 950addc Show full coverage report
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Guard omitted or null options, use a minor release, and strengthen assertions to verify the SdkError class.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (3)
What changed in this PR
Standardizes invalid-argument failures on SdkError, updates messages, tests, documentation, and release metadata.
Changes:
- Converts validation failures to
SdkError. - Updates argument-specific messages and related tests.
- Clarifies error documentation and adds a changeset.
| File | Review summary |
|---|---|
tests/unit-tests/urlUtilsTests.spec.ts |
Updated URL validation tests; error-class assertions should be explicit. |
tests/unit-tests/serverApiClientTests.spec.ts |
Updated client validation tests; error-class assertions should be explicit. |
tests/mocked-responses-tests/pathParamEncodingTests.spec.ts |
Updated wire-level tests; assert the SdkError class separately. |
src/urlUtils.ts |
Converts URL validation failures to SdkError. |
src/serverApiClient.ts |
Uses SdkError for invalid arguments; omitted or null options can still trigger native TypeError. |
src/sealedResults.ts |
Clarifies thrown error documentation. |
src/errors/unsealError.ts |
Updates error documentation and cause handling. |
src/errors/apiErrors.ts |
Clarifies the error hierarchy. |
readme.md |
Updates public error-handling guidance. |
.changeset/sdk-error-for-invalid-arguments.md |
Records the runtime error-class change; should use a minor release. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Omitted and null constructor options now throw |
🚀 Following releases will be created using changesets from this PR:@fingerprint/node-sdk@7.7.2Patch Changes
|


SdkErrorfor invalid arguments: a missing API key,eventId,visitorId, orbody, aneventIdorvisitorIdof.or.., and an unsupported region.eventId is not valid: ..,eventId is not set) instead of a path parameter.RequestErroris unchanged. It still means an HTTP error response.Discussion point: patch for a thrown-type change
Callers who catch
TypeErrorfor a missingeventIdwill no longer match.instanceof SdkErrorwill. This is a patch because those values were already rejected. Push back if it should be a minor.