From 3d28c4e4bcff399e294a507187e051839f74ee87 Mon Sep 17 00:00:00 2001 From: Jokler Date: Sun, 24 Dec 2017 15:55:13 +0100 Subject: Switch to HashMap if the migrations failed to run --- bin/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/main.rs b/bin/main.rs index 8f1877a..9373afd 100644 --- a/bin/main.rs +++ b/bin/main.rs @@ -118,8 +118,13 @@ fn main() { use diesel::Connection; match diesel::mysql::MysqlConnection::establish(url) { Ok(conn) => { - embedded_migrations::run(&conn).unwrap(); - bot.add_plugin(plugins::Factoids::new(conn)); + match embedded_migrations::run(&conn) { + Ok(_) => bot.add_plugin(plugins::Factoids::new(conn)), + Err(e) => { + bot.add_plugin(plugins::Factoids::new(HashMap::new())); + error!("Failed to run migrations: {}", e); + } + } } Err(e) => error!("Failed to connect to database: {}", e), } -- cgit v1.2.3-70-g09d2