summaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-06-06 16:39:04 +0200
committerJustus Winter <justus@sequoia-pgp.org>2018-06-06 16:39:04 +0200
commit47993c61922565bf3bec4ddcab6b1c5f8d378c15 (patch)
tree09c3c5b6d2356ab9c99baf7f43c4533ed4a410f1 /tool
parentdac624a298d33877858d969d90690bdd3c69da92 (diff)
tool: Provide nicer error messages.
Diffstat (limited to 'tool')
-rw-r--r--tool/src/sq.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/tool/src/sq.rs b/tool/src/sq.rs
index cf528cc5..738b291d 100644
--- a/tool/src/sq.rs
+++ b/tool/src/sq.rs
@@ -30,14 +30,16 @@ mod commands;
fn open_or_stdin(f: Option<&str>) -> Result<Box<io::Read>, failure::Error> {
match f {
- Some(f) => Ok(Box::new(File::open(f)?)),
+ Some(f) => Ok(Box::new(File::open(f)
+ .context("Failed to open input file")?)),
None => Ok(Box::new(io::stdin())),
}
}
fn create_or_stdout(f: Option<&str>) -> Result<Box<io::Write>, failure::Error> {
match f {
- Some(f) => Ok(Box::new(File::create(f)?)),
+ Some(f) => Ok(Box::new(File::create(f)
+ .context("Failed to create output file")?)),
None => Ok(Box::new(io::stdout())),
}
}