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

feat(nameguard-sdk): throw errors from API #396

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

notrab
Copy link
Member

@notrab notrab commented Sep 11, 2024

Earlier this year we discussed the idea of adding different error types to the SDK for timeouts, lost connection, server errors and input validation.

This PR starts the conversation about adding such support.

Please note;

  1. There is no changeset, I need to do the other end of this to update nameguard-react

Copy link

changeset-bot bot commented Sep 11, 2024

🦋 Changeset detected

Latest commit: 538dc75

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@namehash/nameguard Minor
@namehash/nameguard-js Patch
@namehash/nameguard-react Patch

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

Copy link

vercel bot commented Sep 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples.nameguard.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 8:09am
nameguard.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 8:09am
namehashlabs.org 🛑 Canceled (Inspect) Oct 10, 2024 8:09am
storybook.namekit.io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2024 8:09am

Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@notrab Thanks for updates. Reviewed and shared feedback 👍

packages/nameguard-sdk/src/index.ts Show resolved Hide resolved
packages/nameguard-sdk/src/index.ts Show resolved Hide resolved
packages/nameguard-sdk/src/index.ts Show resolved Hide resolved
packages/nameguard-sdk/src/index.ts Show resolved Hide resolved
packages/nameguard-sdk/src/index.ts Show resolved Hide resolved
@@ -698,7 +778,9 @@ export class NameGuard {
options?: SecurePrimaryNameOptions,
): Promise<SecurePrimaryNameResult> {
Copy link
Member

Choose a reason for hiding this comment

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

Please also check the nameguard-js package and see if there's anything there that needs to be updated. NameGuard JS implements a subclass of the NameGuard class.

packages/nameguard-sdk/src/index.ts Outdated Show resolved Hide resolved
Copy link
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@notrab Hey just saw your updated comments here. Reviewed and shared feedback 👍

packages/nameguard-sdk/src/index.ts Show resolved Hide resolved
packages/nameguard-sdk/src/index.ts Show resolved Hide resolved
try {
const timeoutId = setTimeout(() => {
this.abortController.abort();
}, 30000); // 30 second timeout
Copy link
Member Author

Choose a reason for hiding this comment

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

We could make this configurable if we need.

I think we could attach timeout to the signal instead from looking at this page. I need to test it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added this to the constructor now.

@vercel vercel bot temporarily deployed to Preview – namehashlabs.org October 10, 2024 08:00 Inactive
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.

2 participants