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

SDK documentation on error handling #122

Merged
merged 2 commits into from
Aug 21, 2023
Merged

Conversation

gvdongen
Copy link
Contributor

Fixes #90

SDK docs on retry strategy of Restate.

  • Infinite by default
  • Use terminal errors to fail the invocation without retries
  • Refer to side effects docs for retry policies of side effects

@netlify
Copy link

netlify bot commented Aug 21, 2023

Deploy Preview for docsrestatedev ready!

Name Link
🔨 Latest commit 0ba4430
🔍 Latest deploy log https://app.netlify.com/sites/docsrestatedev/deploys/64e3401787660f0008dac896
😎 Deploy Preview https://deploy-preview-122--docsrestatedev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@gvdongen gvdongen changed the title Issue#90 SDK documentation on error handling Aug 21, 2023
Copy link
Contributor

@tillrohrmann tillrohrmann left a 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." })
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Contributor

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.

@gvdongen gvdongen merged commit 571f88a into restatedev:main Aug 21, 2023
5 checks passed
@gvdongen gvdongen deleted the issue#90 branch August 21, 2023 15:17
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.

Write docs on SDK error handling
2 participants