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

chore: rename DidBuilderError #650

Merged
merged 2 commits into from
Sep 29, 2022
Merged

chore: rename DidBuilderError #650

merged 2 commits into from
Sep 29, 2022

Conversation

arty-name
Copy link
Collaborator

@arty-name arty-name commented Sep 27, 2022

This PR addresses a TODO remnant from #581 and renames a legacy error.

Checklist:

  • I have verified that the code works
  • I have verified that the code is easy to understand
    • If not, I have left a well-balanced amount of inline comments
  • I have left the code in a better state
  • I have documented the changes (where applicable)

@arty-name arty-name requested a review from tjwelde September 27, 2022 11:34
}
default:
throw new SDKErrors.DidBuilderError(`Unsupported key type "${type}"`)
if (type === 'ed25519' || type === 'sr25519') {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The function is internal anyway and doesn’t have to check for unexpected broken types.

So we don’t need the default case in the switch (have I said the switch statement is problematic?) and don’t have to throw this error here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it checked somewhere else, if the type might be broken?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess some user-facing functions do that, but likely not consistently. Still I think the checks should rather be implemented there instead of mistrusting TS all over the codebase.

Copy link
Contributor

@tjwelde tjwelde left a comment

Choose a reason for hiding this comment

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

LGTM

@arty-name arty-name merged commit 1181c1d into develop Sep 29, 2022
@arty-name arty-name deleted the ta-rename_DidBuilderError branch September 29, 2022 07:26
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