Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch swallows network errors #7

Closed
jchartrand opened this issue Jan 17, 2025 · 0 comments · Fixed by #8
Closed

catch swallows network errors #7

jchartrand opened this issue Jan 17, 2025 · 0 comments · Fixed by #8

Comments

@jchartrand
Copy link
Contributor

This catch in the code to retrieve registry data in RegistryClient.load:

https://github.com/digitalcredentials/issuer-registry-client/blob/bb2f6d3f36bb2148a78f897850b970745886c137/src/index.ts#L115C1-L118C8

swallows all errors so that we can't then report back to the end user that there was a problem.

The error should either be propagated out, or some kind of success/fail result should be returned from the RegistryClient.load method.

To help with troubleshooting, probably best to catch the errors, and build up and return an object that records the results of every call (to retrieve registry data), rather than just throwing the exception after the first failed call. A propagated exception would prevent all subsequent calls (to the various registries) from running, and thereby reduce how much meaningful information we return. It could be, for example, that just the first registry call that fails (because its server is down), and all the others succeed. But without running all the calls we don't know that.

So, suggest we try calling all the registries (and therefore catch errors) and build up a response object like:

[
  {
    "name": "DCC Pilot Registry",
    "url": "https://digitalcredentials.github.io/issuer-registry/registry.json",
    "loaded": false
  },
  {
    "name": "DCC Sandbox Registry",
    "url": "https://digitalcredentials.github.io/sandbox-registry/registry.json",
    "loaded": true
  },
  {
    "name": "DCC Community Registry",
    "url": "https://digitalcredentials.github.io/community-registry/registry.json",
    "loaded": true
  },
  {
    "name": "DCC Registry",
    "url": "https://digitalcredentials.github.io/dcc-registry/registry.json",
    "loaded": false
  }
]
@jchartrand jchartrand linked a pull request Jan 17, 2025 that will close this issue
@jchartrand jchartrand moved this to In Progress in DCC Engineering Jan 17, 2025
@jchartrand jchartrand moved this from In Progress to Ready for PR Review/re-test in DCC Engineering Jan 17, 2025
@alexfigtree alexfigtree moved this from Ready for PR Review/re-test to Release Ready in DCC Engineering Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Release Ready
Development

Successfully merging a pull request may close this issue.

1 participant