aboutsummaryrefslogtreecommitdiffstats
path: root/src/listing.rs
diff options
context:
space:
mode:
authorboasting-squirrel <boasting.squirrel@gmail.com>2019-03-12 18:23:22 +0000
committerboasting-squirrel <boasting.squirrel@gmail.com>2019-03-12 18:23:22 +0000
commit67d771fc3a954ea439e77afac092c84c5489d074 (patch)
tree2316eaa7ee80299abbc5fbb066cf1663e44e3461 /src/listing.rs
parentStarted to add helpful messages for errors which could occur during archiving (diff)
downloadminiserve-67d771fc3a954ea439e77afac092c84c5489d074.tar.gz
miniserve-67d771fc3a954ea439e77afac092c84c5489d074.zip
Added some error messages + reworked the print_error_chain method
Diffstat (limited to 'src/listing.rs')
-rw-r--r--src/listing.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/listing.rs b/src/listing.rs
index ab3b28b..a9f0f19 100644
--- a/src/listing.rs
+++ b/src/listing.rs
@@ -7,7 +7,7 @@ use serde::Deserialize;
use std::io;
use std::path::Path;
use std::time::SystemTime;
-use yansi::{Color, Paint};
+use yansi::Color;
use crate::archive;
use crate::errors;
@@ -238,8 +238,9 @@ pub fn directory_listing<S>(
match archive::create_archive_file(&compression_method, &dir.path) {
Ok((filename, content)) => {
println!(
- "{success} Archive successfully created !",
- success = Color::Green.paint("success:").bold()
+ "{success} {file} successfully created !",
+ success = Color::Green.paint("success:").bold(),
+ file = Color::White.paint(&filename).bold(),
);
Ok(HttpResponse::Ok()
.content_type(compression_method.content_type())
@@ -254,12 +255,7 @@ pub fn directory_listing<S>(
.body(Body::Streaming(Box::new(once(Ok(content))))))
}
Err(err) => {
- println!(
- "{error} {err}",
- error = Paint::red("error:").bold(),
- err = Paint::white(&err).bold()
- );
- errors::print_chain(err);
+ errors::print_error_chain(err);
Ok(HttpResponse::Ok()
.status(http::StatusCode::INTERNAL_SERVER_ERROR)
.body(""))