-
Notifications
You must be signed in to change notification settings - Fork 892
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
Completely overhaul error handling #358
Merged
Merged
Changes from 60 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
82212cb
Move notifications to their own modules
brson 8e76c56
Add the rustup-error crate
brson 4dd554c
Convert rustup-utils to easy_error
brson 357f61b
Use chain_error in rustup utils to avoid throwing away errors
brson 74129d4
Lots of refactoring for ergonomics
brson b95261f
Define rust-dist Error2 type with easy_error
brson d1756c5
Build ErrorChain in the easy_error macro
brson 62f85e2
Remove the non-pub version of the macro. Bothersome to maintain
brson 15278d9
Tweak the easy_error! syntax to make room for more declaration types
brson 81f6da3
Specify the error chain name in the easy_error syntax
brson 7cf11b8
Remove extra type parameter from ErrorChain
brson 20b101f
Just move the ChainError trait into the macro
brson 9617ef9
Convert rustup-dist to rustup-error
brson b742d8c
Introduce ForeignError
brson e6f3d2c
Remove unused from
brson 7964a3c
Remove Implementation of StdError from error types
brson 1c76430
Convert rustup to rustup-error
brson 5830eb9
Remove explicit attributes from easy_error
brson 6d479d1
Remove pub modifiers from easy_error syntax
brson f8c3144
Simplify macro syntax further
brson 386cf30
Remove unused macro
brson 20f00c7
Put from conversions into the macro
brson 8457586
Port tests
brson ef99cfd
Move Result typedef into the macro
brson 4bf2114
More macro syntax tweaking
brson 9907aab
Rename Error::Install to Error::Dist
brson f309646
Swap type declaration order
brson 5fa31ce
Fix some unix compile errors
brson 78f9cb7
Rename ErrorChain to Error, Error to ErrorKind
brson e3ea815
from_links -> links
brson c632b2c
Remove unused variant
brson 6b70c8a
Anything implementing Into can be chained
brson e472c4d
from_link -> link
brson 2cd6175
Convert some errors to basic errors
brson c8983f4
chain_error -> chain_err
brson f301e2b
Add an 'err' function to the macro for initializing the error chain
brson 948203a
Remove unused error variants
brson 370dca5
Cleanup the macro
brson 35bc8a9
Remove the err function in favor Into
brson 8021be1
Replace trivial error types in rustup-dist
brson ca8baae
Give rustup-cli its own errors
brson 55b6157
Add backtraces
brson 9f13f4e
Remove the unchained method
brson 7de5e05
Remove an Error::from
brson 251a36c
wip
brson df4f117
Remove the 'chained' method
brson ce445cb
Fix some macro variable names
brson 07d75ea
Whitespace
brson 2b13273
Propagate backtraces
brson 1cc995b
Write some docs
brson 03ad55b
Add an iter method to Error to iterate over the error chain
brson c829831
Convert line endings
brson fabe758
Allow dead Windows-specific variants
brson 4540b9a
Print the error chain and (optionally) backtrace on error
brson ea5a8fe
Rename inner method to 'kind'
brson e57aeb8
Put the Backtrace in an Arc
brson 968c1c4
Simplify backtrace propagation
brson 6a4bbef
Simplify foreign errors
brson a062ea3
More docs
brson d42d7dc
Fix some tests
brson 7eb3be5
Remove some unused type inference hacks
brson c5745df
Remove stray Cargo.lock
brson 1e0c68a
Typos
brson 820ce07
Combine error chain and backtrace into a single field of Error
brson 5d76f86
Small tweaks
brson d33e4a3
Rename rustup-error to error-chain
brson c04b430
Rename declare_errors to error_chain
brson 6cefd93
Small doc improvements
brson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#![allow(dead_code)] | ||
|
||
use std::path::PathBuf; | ||
|
||
use rustup; | ||
use rustup_dist::{self, temp}; | ||
use rustup_utils; | ||
|
||
declare_errors! { | ||
types { | ||
Error, ErrorKind, ChainErr, Result; | ||
} | ||
|
||
links { | ||
rustup::Error, rustup::ErrorKind, Rustup; | ||
rustup_dist::Error, rustup_dist::ErrorKind, Dist; | ||
rustup_utils::Error, rustup_utils::ErrorKind, Utils; | ||
} | ||
|
||
foreign_links { | ||
temp::Error, Temp, | ||
"temporary file error"; | ||
} | ||
|
||
errors { | ||
PermissionDenied { | ||
description("permission denied") | ||
} | ||
ToolchainNotInstalled(t: String) { | ||
description("toolchain is not installed") | ||
display("toolchain '{}' is not installed", t) | ||
} | ||
InfiniteRecursion { | ||
description("infinite recursion detected") | ||
} | ||
NoExeName { | ||
description("couldn't determine self executable name") | ||
} | ||
NotSelfInstalled(p: PathBuf) { | ||
description("rustup is not installed") | ||
display("rustup is not installed at '{}'", p.display()) | ||
} | ||
WindowsUninstallMadness { | ||
description("failure during windows uninstall") | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
Is this due to the macro recursing on itself?
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.
Yes.