Skip to content

fix: replace misleading error messages in key fetching#1

Open
luchobonatti wants to merge 1 commit intomainfrom
fix/379-error-handling
Open

fix: replace misleading error messages in key fetching#1
luchobonatti wants to merge 1 commit intomainfrom
fix/379-error-handling

Conversation

@luchobonatti
Copy link
Copy Markdown
Member

@luchobonatti luchobonatti commented Apr 8, 2026

Closes zama-ai#379

Summary

  • Replace catch-all "Impossible to fetch public key: wrong relayer url." with neutral, resource-specific messages using TFHEError
  • Original cause.message is now auto-surfaced as Details: via RelayerErrorBase, fixing the problem of environments that don't support Error.cause

Changes

File Change
src/relayer-provider/v1/networkV1.ts Use TFHEError with "Failed to fetch keys from relayer"
src/sdk/lowlevel/TFHEPublicKey.ts Message → "Failed to fetch public key"
src/sdk/lowlevel/TFHEPkeCrs.ts Message → "Failed to fetch CRS"
src/sdk/lowlevel/TFHEPkeParams.ts Message → "Failed to fetch PKE params"
src/sdk/lowlevel/TFHEPublicKey.test.ts Update 3 assertions
src/sdk/lowlevel/TFHEPkeCrs.test.ts Update 3 assertions
src/sdk/lowlevel/TFHEPkeParams.test.ts Update 2 assertions

Test plan

  • prettier:check passes
  • eslint passes
  • 87 tests pass across 4 affected suites

Copilot AI review requested due to automatic review settings April 8, 2026 18:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates key-fetching error messages to be neutral and resource-specific, replacing a misleading catch-all message and standardizing errors around TFHEError so underlying causes surface consistently.

Changes:

  • Replaced the generic “wrong relayer url” message with resource-specific messages for public key / CRS / PKE params fetches.
  • Switched getKeysFromRelayer to throw TFHEError with a neutral “Failed to fetch keys from relayer” message.
  • Updated affected unit tests to assert the new messages.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/relayer-provider/v1/networkV1.ts Wrap key-fetch failures in TFHEError with a neutral message.
src/sdk/lowlevel/TFHEPublicKey.ts Update fetch wrapper message to “Failed to fetch public key”.
src/sdk/lowlevel/TFHEPkeCrs.ts Update fetch wrapper message to “Failed to fetch CRS”.
src/sdk/lowlevel/TFHEPkeParams.ts Update fetch wrapper message to “Failed to fetch PKE params”.
src/sdk/lowlevel/TFHEPublicKey.test.ts Update assertions to match the new public key fetch error message.
src/sdk/lowlevel/TFHEPkeCrs.test.ts Update assertions to match the new CRS fetch error message.
src/sdk/lowlevel/TFHEPkeParams.test.ts Update assertions to match the new PKE params fetch error message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Error handling: getKeysFromRelayer wraps all errors as 'wrong relayer url'

2 participants