Skip to content

Document built-in exceptions#880

Merged
fhammerschmidt merged 4 commits intomasterfrom
document-builtin-exceptions
Jun 12, 2024
Merged

Document built-in exceptions#880
fhammerschmidt merged 4 commits intomasterfrom
document-builtin-exceptions

Conversation

@aspeddro
Copy link
Copy Markdown
Collaborator

@aspeddro aspeddro commented Jun 8, 2024

Close #872

@aspeddro aspeddro self-assigned this Jun 8, 2024
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 8, 2024

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

Name Status Preview Comments Updated (UTC)
rescript-lang.org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2024 0:19am

Comment thread pages/docs/manual/latest/exception.mdx Outdated
# Exception

Exceptions are just a special kind of variant, thrown in **exceptional** cases (don't abuse them!).
Exceptions are just a special kind of variant, thrown in **exceptional** cases (don't abuse them!). Consider using the `option` or `result` type for recoverable errors.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Link to the corresponding docs page(s) for Option and Result please.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

we don't have documented the result builtin type

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

maybe add Result page after Null, Undefined and Option

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added link to option 8544ec9

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. Yes we need to document Result somewhere, but we can fix the link afterwards.
Or just link to the Core Result Api page for now?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Comment thread pages/docs/manual/latest/exception.mdx Outdated
Comment thread pages/docs/manual/latest/exception.mdx Outdated
You can also make your own exceptions like you'd make a variant (exceptions need to be capitalized too).
### `Invalid_argument`

Used to check if argument is valid. This exception takes a string
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

don't forget the .

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Comment thread pages/docs/manual/latest/exception.mdx Outdated
Error: new Error()
};
Exception raised to signal that the given arguments do not make sense. This
exception take a string as argument.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

takes a string as an argument

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Where can I find all the built-in exception documentation, like Not_found?

2 participants