feat: add terminal error extension - #88
Merged
Merged
Conversation
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
| /// Convert the error into a [`TerminalError`] with the default status code (500). | ||
| fn terminal(self) -> Result<T, HandlerError>; | ||
| /// Convert the error into a [`TerminalError`] with a custom status code. | ||
| fn terminal_with_code(self, code: u16) -> Result<T, HandlerError>; |
Contributor
There was a problem hiding this comment.
i suggest we remove this, and instead add set_code(mut self, code): Self/with_code() to the terminal error itself. In future the terminal error will be extended with other fields, so adding here in this trait all the variants will just pollute the context.
slinkydeveloper
left a comment
Contributor
There was a problem hiding this comment.
left a small comment, otherwise it's good
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Contributor
Author
|
@slinkydeveloper thanks for the review! Makes sense, made the requested change. |
| pub use crate::serde::Json; | ||
| } | ||
|
|
||
| pub use crate::errors::TerminalErrorExt; |
Contributor
There was a problem hiding this comment.
IMO this goes in the prelude?
| /// Set the status code for this [`TerminalError`]. | ||
| /// | ||
| /// ```rust,no_run | ||
| /// use restate_sdk::prelude::TerminalError; |
Contributor
There was a problem hiding this comment.
Suggested change
| /// use restate_sdk::prelude::TerminalError; | |
| /// use restate_sdk::prelude::*; |
Contributor
|
just two small nits and we can merge |
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
Contributor
Author
|
Done and done :) |
slinkydeveloper
approved these changes
Jul 21, 2026
Contributor
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #87