Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 0.1.0

* JS SDK: `onError` callback now provides specific error messages indicating what went wrong during verification (proof generation failed, verification error, proof not verified, or proof submission failed) instead of generic errors
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Citation: Documents PR #80 which enhances error handling by propagating contextual error messages from API responses through the onError callback instead of generic fallbacks.
View source

* Added EU region support documentation for JS SDK - use `https://eu.portal.reclaimprotocol.org` as `customSharePageUrl` to automatically route API requests to the EU backend
* **JS SDK**: When using a regional portal (any `customSharePageUrl` other than `share.reclaimprotocol.org` or `portal.reclaimprotocol.org`), you must now set a callback URL using `setAppCallbackUrl()`. The SDK throws a `CallbackUrlRequiredError` if missing.
* Added log event type documentation for inapp sdk and inapp react native sdk
25 changes: 25 additions & 0 deletions content/docs/js-sdk/generating-proof.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,31 @@ onSuccess is called after the user has generated the proof, but you must [verify
> [!TIP]
> **Best Practice:** When using `setAppCallbackUrl` and/or `setCancelCallbackUrl`, your backend receives the proof or cancellation details directly. We recommend your backend notifies the frontend (e.g. via WebSockets, SSE, or polling) to stop the verification process and handle the appropriate success/failure action. Do not rely completely on `startSession` callbacks on the frontend when using these backend callbacks.

## Error Handling
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Citation: Error types and messages based on changes in src/Reclaim.ts (lines 1382-1418) where ProviderFailedError, ErrorDuringVerificationError, ProofNotVerifiedError, and ProofSubmissionFailedError now include session.errorMessage or specific fallback messages.
View source


The `onError` callback receives an error object with a `message` property describing what went wrong. The SDK returns specific error messages based on the failure type:

| Error Type | Message |
| --- | --- |
| **Proof Generation Failed** | Server-specific error details, or "Proof generation failed - timeout reached" |
| **Verification Error** | Server-specific error details, or "An error occurred during the verification process" |
| **Proof Not Verified** | "Proof verification failed - the generated proof could not be verified" |
| **Proof Submission Failed** | Server-specific error details, or "Proof submission failed" |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Citation: Updated the ProofSubmissionFailedError fallback message to match the implementation in src/Reclaim.ts line 1439: const errorMessage = statusUrlResponse.session.error?.message || 'Proof submission failed'
View source


Use these messages to show meaningful feedback to your users:

```javascript
await reclaimProofRequest.startSession({
onSuccess: (proofs) => {
// handle successful verification
},
onError: (err) => {
console.error('Verification failed:', err.message);
// Display err.message to the user for specific error details
}
});
```

## Example using `React`
```javascript
// hooks/useReclaim.js
Expand Down