-
Notifications
You must be signed in to change notification settings - Fork 9
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
Document @solana/errors
with TypeDoc
#66
base: main
Are you sure you want to change the base?
Conversation
|
BundleMonFiles updated (3)
Unchanged files (124)
Total files change +497B +0.14% Final result: ✅ View report in BundleMon website ➡️ |
* A type guard that returns `true` if the input is a {@link SolanaError}, optionally with a | ||
* particular error code. | ||
* | ||
* When the `code` argument is supplied and the input is a {@link SolanaError}, TypeScript will | ||
* refine the error's {@link SolanaError#context | `context`} property to the type associated with | ||
* that error code. You can use that context to render useful error messages, or to make | ||
* context-aware decisions that help your application to recover from the error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully documenting this here will make it show in in people's autocomplete, then they'll see the example, and better understand how to take advantage of the full power of this assertion.
* > [!IMPORTANT] | ||
* > The string representation of a {@link SolanaError} should not be shown to users. Developers | ||
* > should use {@link isSolanaError} to distinguish the type of a thrown error, then show a custom, | ||
* > localized error message appropriate for their application's audience. Custom error messages | ||
* > should use the error's {@link SolanaError#context | `context`} if it would help the reader | ||
* > understand what happened and/or what to do next. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this.
2195610
to
0433a03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful. 👌
This PR moves content from the README into the code.
Addresses #50
Test Plan
cd packages/errors pnpm typedoc --watch \ --plugin typedoc-plugin-missing-exports \ --plugin typedoc-plugin-mdn-links python3 -m http.server -d docs
Preview here: https://silly-creponne-8b5941.netlify.app/