diff options
-rw-r--r-- | src/main.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 55afb00..395e683 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,6 +38,7 @@ use clap::{App, Arg, ArgMatches}; use api::{Api, Profession, Skill}; use bt::{BuildTemplate, ExtraData, Legend, TraitChoice, Traitline}; +use render::RenderError; /// The name of this application. /// @@ -360,11 +361,18 @@ fn run() -> MainResult<()> { } let mut renderer = render::Renderer::new(&mut api, Default::default()); - if let Ok(img) = renderer.render_buildtemplate(&build) { - let filename = matches.value_of("outfile").unwrap(); - img.save(filename)?; - if !matches.is_present("quiet") { - println!("Image saved in {}", filename); + match renderer.render_buildtemplate(&build) { + Ok(img) => { + let filename = matches.value_of("outfile").unwrap(); + img.save(filename)?; + if !matches.is_present("quiet") { + println!("Image saved in {}", filename); + } + }, + Err(RenderError::EmptyBuild) => (), + Err(err) => { + eprintln!("Image could not be rendered:"); + output::show_error(&err)?; } } |