-
Notifications
You must be signed in to change notification settings - Fork 15
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
Expect removed from various places #197
base: main
Are you sure you want to change the base?
Conversation
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!!
.bucket(bucket_name) | ||
.send() | ||
.await | ||
.context(format!("Failed to create bucket: {} in us-east-1", bucket_name))?; |
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.
Can we try to change this
if self.bucket_location_constraint.as_str() == "us-east-1" {
and compare the enums provided by AWS.
Accordingly change the context
to not hardcode us-east-1
Note: I tried doing this in a recent PR but the code was failing after
maybe you can try and this time it might work ?
WDYT @Mohiiit ?
@@ -231,7 +231,8 @@ fn parse_worker_message(message: &Delivery) -> Result<Option<WorkerTriggerMessag | |||
.borrow_payload() | |||
.ok_or_else(|| ConsumptionError::Other(OtherError::from("Empty payload".to_string())))?; | |||
let message_string = String::from_utf8_lossy(payload).to_string().trim_matches('\"').to_string(); | |||
let trigger_type = WorkerTriggerType::from_str(message_string.as_str()).expect("trigger type unwrapping failed"); | |||
let trigger_type = WorkerTriggerType::from_str(message_string.as_str()) | |||
.map_err(|e| ConsumptionError::Other(OtherError::from(e)))?; |
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.
Let's add a wrap_err
here as well,
seems like a good practice to follow
WDYT @Mohiiit ?
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.
valid added
@@ -85,8 +85,7 @@ impl AtlanticClient { | |||
) | |||
.send() | |||
.await | |||
.map_err(AtlanticError::AddJobFailure) | |||
.expect("Failed to add job"); | |||
.map_err(AtlanticError::AddJobFailure)?; |
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.
Same, can add wrap_err
here
WDYT on adding wrap_err
throughout the code @Mohiiit ?
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.
I don't think it makes sense here, because wrap_err is used to provide extra context to the error, in here the only context is that the add job failure happened which is already handled by the AtlanticError here
but I will research about the best practices here and will come back here
Removed expect and added wrap for the error