-
Notifications
You must be signed in to change notification settings - Fork 7
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
SDK documentation on error handling #122
Conversation
✅ Deploy Preview for docsrestatedev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
LGTM. +1 for merging.
|
||
// Inside your handler throw terminal errors via: | ||
throw new TerminalError("Something went wrong.", { errorCode: 13, cause: "Something caused this." }) |
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.
Do we expose the error codes as an enum from the SDK?
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.
Right, we indeed expose those 👍 I will adapt it
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.
Hmm the only ones we expose are: internal, journal_mismatch and protocol_violation... Maybe that is not really worth exposing or documenting? Since journal mismatch and protocol violations are not something the user code detects
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.
Yes, we shouldn't expose journal_mismatch or protocol_violation to the user. Maybe at some point we want to expose something like an UserErrorCode
that is aligned with https://github.com/restatedev/restate/blob/ebf084cdfa2639e192911d90394fdcc0168eeefe/src/types/src/errors.rs#L21 in case users want to use error codes across SDKs. Then let's leave it as is for now.
Fixes #90
SDK docs on retry strategy of Restate.