diff --git a/examples/mysql/todos/src/main.rs b/examples/mysql/todos/src/main.rs index e2ed6f13..246603ef 100644 --- a/examples/mysql/todos/src/main.rs +++ b/examples/mysql/todos/src/main.rs @@ -1,3 +1,4 @@ +use anyhow::Context; use sqlx::mysql::MySqlQueryAs; use sqlx::MySqlPool; use std::env; @@ -18,7 +19,10 @@ enum Command { #[async_std::main] #[paw::main] async fn main(args: Args) -> anyhow::Result<()> { - let pool = MySqlPool::new(&env::var("DATABASE_URL")?).await?; + let pool = MySqlPool::new( + &env::var("DATABASE_URL").context("`DATABASE_URL` must be set to run this example")?, + ) + .await?; match args.cmd { Some(Command::Add { description }) => { diff --git a/examples/postgres/todos/src/main.rs b/examples/postgres/todos/src/main.rs index 90942bb6..d9f0238a 100644 --- a/examples/postgres/todos/src/main.rs +++ b/examples/postgres/todos/src/main.rs @@ -1,3 +1,4 @@ +use anyhow::Context; use sqlx::PgPool; use std::env; use structopt::StructOpt; @@ -17,7 +18,10 @@ enum Command { #[async_std::main] #[paw::main] async fn main(args: Args) -> anyhow::Result<()> { - let mut pool = PgPool::new(&env::var("DATABASE_URL")?).await?; + let mut pool = PgPool::new( + &env::var("DATABASE_URL").context("`DATABASE_URL` must be set to run this example")?, + ) + .await?; match args.cmd { Some(Command::Add { description }) => { diff --git a/examples/sqlite/todos/src/main.rs b/examples/sqlite/todos/src/main.rs index 46ba258c..e9aaebf7 100644 --- a/examples/sqlite/todos/src/main.rs +++ b/examples/sqlite/todos/src/main.rs @@ -1,3 +1,4 @@ +use anyhow::Context; use sqlx::sqlite::SqliteQueryAs; use sqlx::SqlitePool; use std::env; @@ -18,7 +19,10 @@ enum Command { #[async_std::main] #[paw::main] async fn main(args: Args) -> anyhow::Result<()> { - let pool = SqlitePool::new(&env::var("DATABASE_URL")?).await?; + let pool = SqlitePool::new( + &env::var("DATABASE_URL").context("`DATABASE_URL` must be set to run this example")?, + ) + .await?; match args.cmd { Some(Command::Add { description }) => {