-
-
Notifications
You must be signed in to change notification settings - Fork 250
Document built-in exceptions #880
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -6,9 +6,36 @@ canonical: "/docs/manual/latest/exception" | |||
|
|||
# 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. |
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.
Link to the corresponding docs page(s) for Option and Result please.
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.
we don't have documented the result
builtin type
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.
maybe add Result
page after Null, Undefined and Option
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 link to option 8544ec9
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.
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?
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.
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 |
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.
don't forget the .
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.
Error: new Error() | ||
}; | ||
Exception raised to signal that the given arguments do not make sense. This | ||
exception take a string as argument. |
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.
takes a string as an argument
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.
Close #872