From b19b031a5052a268f323a116403ea66ca71ea575 Mon Sep 17 00:00:00 2001 From: Zeyla Hellyer Date: Wed, 1 Nov 2017 20:47:08 -0700 Subject: Make the Client return a Result The client now returns a Result in preparation of a future commit. Upgrade path: Handle the case of an error via pattern matching, or unwrap the Result. --- examples/07_sample_bot_structure/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/07_sample_bot_structure/src') diff --git a/examples/07_sample_bot_structure/src/main.rs b/examples/07_sample_bot_structure/src/main.rs index 8962d55..7a0c216 100644 --- a/examples/07_sample_bot_structure/src/main.rs +++ b/examples/07_sample_bot_structure/src/main.rs @@ -21,7 +21,9 @@ use std::env; struct Handler; impl EventHandler for Handler {} fn main() { - let mut client = Client::new(&env::var("DISCORD_TOKEN").unwrap(), Handler); + let token = env::var("DISCORD_TOKEN") + .expect("Expected a token in the environment"); + let mut client = Client::new(&token, Handler).expect("Err creating client"); client.with_framework(StandardFramework::new() .configure(|c| c.prefix("~")) -- cgit v1.2.3