aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-12-31 19:49:51 -0800
committerJoe Wilm <joe@jwilm.com>2016-12-31 20:47:29 -0800
commita86dfd1a113f62fb6c40ebf5fe80f30a60cdff99 (patch)
tree8e9c303424385fb66b5dac1a887a5c279b1c24c6 /src/main.rs
parent2738969f292c5202800f61d4f073d82aef436836 (diff)
downloadalacritty-a86dfd1a113f62fb6c40ebf5fe80f30a60cdff99.tar.gz
alacritty-a86dfd1a113f62fb6c40ebf5fe80f30a60cdff99.zip
Print nice error messages for font loading errors
Resolves #22.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index cce55354..a1c8e77c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -52,12 +52,20 @@ fn main() {
// Run alacritty
if let Err(err) = run(config, options) {
- die!("{}", err);
+ die!("Alacritty encountered an unrecoverable error:\n\n\t{}\n", Red(err));
}
println!("Goodbye");
}
+use std::fmt;
+struct Red<T>(T);
+impl<T: fmt::Display> fmt::Display for Red<T> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "\x1b[31m{}\x1b[0m", self.0)
+ }
+}
+
/// Run Alacritty
///
/// Creates a window, the terminal state, pty, I/O event loop, input processor,