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

Added error for downloading bogus versions #428

Merged
merged 1 commit into from
May 10, 2016
Merged

Conversation

cramertj
Copy link
Member

Fixes #390

I'm not sure if this is exactly what you had in mind-- I didn't see quite how to compose it with chain_err without catching all of the errors returned from the call to update_v1, but I got it working nonetheless.

Ok(Some(hash)) => Ok(Some(hash)),
Err(Error(ErrorKind::Utils(rustup_utils::ErrorKind::Download404 { .. }), e)) => {
Err(Error(ErrorKind::Utils(rustup_utils::ErrorKind::Download404BadVers { vers: toolchain_str }), e))
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get rid of some of this boilerplate how about something like

e @ Err(Error(ErrorKind::Utils(rustup_utils::ErrorKind::Download404 { .. }), _)) = {
   e.chain_err(|| format!("could not download nonexistent rust version `{}`", toolchain_str)
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's it! I was neglecting the @ syntax.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed the change.

@brson brson merged commit a9fa226 into rust-lang:master May 10, 2016
@brson
Copy link
Contributor

brson commented May 10, 2016

Thanks!

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.

2 participants