diff options
| author | Jokler <jokler.contact@gmail.com> | 2017-12-24 15:55:13 +0100 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2017-12-24 15:55:13 +0100 |
| commit | 3d28c4e4bcff399e294a507187e051839f74ee87 (patch) | |
| tree | 80a5c7c2fe535575a5f9f3dad27dde8a035d1588 /bin/main.rs | |
| parent | c0f68f11396713ffc1ec99ee49b9c16ff55f6824 (diff) | |
| download | frippy-3d28c4e4bcff399e294a507187e051839f74ee87.tar.gz frippy-3d28c4e4bcff399e294a507187e051839f74ee87.zip | |
Switch to HashMap if the migrations failed to run
Diffstat (limited to 'bin/main.rs')
| -rw-r--r-- | bin/main.rs | 9 |
1 files changed, 7 insertions, 2 deletions
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), } |
