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

Expect removed from various places #197

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Expect removed from various places #197

wants to merge 3 commits into from

Conversation

Mohiiit
Copy link
Contributor

@Mohiiit Mohiiit commented Dec 24, 2024

Removed expect and added wrap for the error

@coveralls
Copy link

coveralls commented Dec 24, 2024

Coverage Status

coverage: 67.373% (-0.08%) from 67.449%
when pulling 5cf92f2 on fix/s3-error
into a008642 on main.

@Mohiiit Mohiiit self-assigned this Dec 26, 2024
@Mohiiit Mohiiit requested a review from ocdbytes December 26, 2024 10:23
Copy link
Member

@ocdbytes ocdbytes left a 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))?;
Copy link
Contributor

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)))?;
Copy link
Contributor

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 ?

Copy link
Contributor Author

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)?;
Copy link
Contributor

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 ?

Copy link
Contributor Author

@Mohiiit Mohiiit Dec 27, 2024

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

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.

5 participants