-
Notifications
You must be signed in to change notification settings - Fork 173
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
Add concrete error types to JetStream #874
Conversation
4b4d17a
to
7714869
Compare
6b48665
to
bd17238
Compare
93f0db4
to
96b8f86
Compare
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.
Good work, some tiny nits / callouts
@@ -0,0 +1,476 @@ | |||
// Copyright 2020-2022 The NATS Authors |
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.
This is all response related, maybe time for a response module?
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Deserialize, Serialize)] | ||
pub struct ErrorCode(u64); |
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.
Move this into jetstream::response?
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.
as agreed, for now, made jetstream::error
module not public ,and exposed Error and ErrorCode
|
||
/// `Error` type returned from an API response when an error occurs. | ||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] | ||
pub struct Error { |
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.
Move this into jetstream::response
?
async-nats/src/jetstream/mod.rs
Outdated
@@ -132,6 +132,7 @@ use crate::Client; | |||
pub mod account; | |||
pub mod consumer; | |||
pub mod context; | |||
pub mod 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.
Think this module can be flattened into response (with into_future requests, we'll probably be having a request module too).
pub mod errors; | |
pub mod response; |
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.
Flattened as agreed on chat.
Error accessible via async_nats::jetstream::Error
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.
Two more abbrevs
ca07d72
to
6f9d4d4
Compare
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
6f9d4d4
to
cb3edc5
Compare
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
TODO: