Improve error handling
This commit is contained in:
parent
a50b140945
commit
6f2ad6990a
22
src/main.rs
22
src/main.rs
@ -42,13 +42,21 @@ fn main() {
|
|||||||
|
|
||||||
guild_list.into_iter().for_each(|name| {
|
guild_list.into_iter().for_each(|name| {
|
||||||
thread::sleep_ms(2500);
|
thread::sleep_ms(2500);
|
||||||
println!("Getting {:?}", name);
|
println!("Getting {:?} -> ", name);
|
||||||
let guild = Guild { prefix: wynncraft::guild(&name).unwrap().unwrap().prefix, name };
|
if let Ok(Some(prefix)) = wynncraft::guild(&name).map(|x| x.map(|x| x.prefix)) {
|
||||||
diesel::insert_into(guilds::table)
|
let guild = Guild { prefix, name };
|
||||||
.values(&guild)
|
if let Ok(_) = diesel::insert_into(guilds::table)
|
||||||
.on_conflict(guilds::prefix)
|
.values(&guild)
|
||||||
.do_nothing()
|
.on_conflict(guilds::prefix)
|
||||||
.execute(&conn).unwrap();
|
.do_nothing()
|
||||||
|
.execute(&conn) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
println!("Fail!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println!("Fail!");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
println!("Guilds updated!");
|
println!("Guilds updated!");
|
||||||
|
Loading…
Reference in New Issue
Block a user