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

add response object #8

Merged
merged 3 commits into from
Jan 18, 2025
Merged

add response object #8

merged 3 commits into from
Jan 18, 2025

Conversation

jchartrand
Copy link
Contributor

Returns a response object from the load method, like so:

[
  {
    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
  }
]

and when a call fails:

[
  {
    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/reggggistry.json',
    loaded: false,
    error: HTTPError: Request failed with status code 404 Not Found: GET https://digitalcredentials.github.io/community-registry/reggggistry.json
        at function_ (file:///Users/jameschartrand/Documents/github/dcc/issuer-registry-client/node_modules/ky/source/core/Ky.ts:56:17)
        at processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async Ky._retry (file:///Users/jameschartrand/Documents/github/dcc/issuer-registry-client/node_modules/ky/source/core/Ky.ts:258:11)
        at async _handleResponse (/Users/jameschartrand/Documents/github/dcc/issuer-registry-client/node_modules/@digitalcredentials/http-client/dist/httpClient.js:104:16)
        at async /Users/jameschartrand/Documents/github/dcc/issuer-registry-client/src/index.ts:108:31
        at async Promise.all (index 1)
        at async RegistryClient.load (/Users/jameschartrand/Documents/github/dcc/issuer-registry-client/src/index.ts:104:5)
        at async Context.<anonymous> (/Users/jameschartrand/Documents/github/dcc/issuer-registry-client/test/registryClient.spec.ts:56:20) {
      response: [Response],
      request: [Request],
      options: [Object],
      requestUrl: 'https://digitalcredentials.github.io/community-registry/reggggistry.json',
      status: 404
    }
  }
]

@jchartrand jchartrand linked an issue Jan 17, 2025 that may be closed by this pull request
Copy link
Member

@dmitrizagidulin dmitrizagidulin left a comment

Choose a reason for hiding this comment

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

👍 great work on this. (also, very much appreciate the unit testing!)

@jchartrand jchartrand merged commit 7181066 into main Jan 18, 2025
2 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.

catch swallows network errors
2 participants