aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-11-10 01:18:00 +0100
committerTeddy Wing2018-11-10 01:18:00 +0100
commit9c19f2ab86ed35b4e27b651dec3d2536344868e4 (patch)
tree1476ecd57cc99cd1aa3291a00680512eff37162b
parentf4cf898ba755ee7feeb5994847d3575e74718cc1 (diff)
downloaddome-key-web-9c19f2ab86ed35b4e27b651dec3d2536344868e4.tar.bz2
Add better messages on environment variable error
Otherwise it doesn't indicate the name of the environment variable in the result output: Error: Error(EnvVar(NotPresent), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })
-rw-r--r--license-generator/src/database.rs3
-rw-r--r--license-generator/src/main.rs3
2 files changed, 4 insertions, 2 deletions
diff --git a/license-generator/src/database.rs b/license-generator/src/database.rs
index 94e925f..505a788 100644
--- a/license-generator/src/database.rs
+++ b/license-generator/src/database.rs
@@ -5,7 +5,8 @@ use mysql;
use errors::*;
pub fn get_database_connection() -> Result<mysql::PooledConn> {
- let connection_url = env::var("DATABASE_URL")?;
+ let connection_url = env::var("DATABASE_URL")
+ .chain_err(|| "DATABASE_URL environment variable not found")?;
let pool = mysql::Pool::new_manual(10, 50, connection_url)?;
let cx = pool.get_conn()?;
diff --git a/license-generator/src/main.rs b/license-generator/src/main.rs
index 5c1a0aa..d428af4 100644
--- a/license-generator/src/main.rs
+++ b/license-generator/src/main.rs
@@ -18,7 +18,8 @@ use license_generator::errors::*;
use license_generator::purchaser::Purchaser;
fn main() -> Result<()> {
- let log_file_path = env::var("LOG_FILE")?;
+ let log_file_path = env::var("LOG_FILE")
+ .chain_err(|| "LOG_FILE environment variable not found")?;
let log_file = OpenOptions::new()
.append(true)