improve new game form
This commit is contained in:
@@ -60,7 +60,7 @@ impl Instance {
|
||||
phase: InstancePhase::Lobby,
|
||||
open: true,
|
||||
max_players: 2,
|
||||
max_rounds: 16,
|
||||
max_rounds: 2,
|
||||
name: String::new(),
|
||||
password: None,
|
||||
phase_end: Utc::now(),
|
||||
|
||||
@@ -9,6 +9,8 @@ use serde_cbor::{to_vec};
|
||||
use std::env;
|
||||
use std::thread::{spawn, sleep};
|
||||
use std::time::Duration;
|
||||
use std::any::Any;
|
||||
use std::panic;
|
||||
|
||||
use r2d2::{Pool};
|
||||
use r2d2::{PooledConnection};
|
||||
@@ -59,7 +61,29 @@ pub fn db_connection(url: String) -> Pool<PostgresConnectionManager> {
|
||||
.expect("Failed to create pool.")
|
||||
}
|
||||
|
||||
fn print_panic_payload(ctx: &str, payload: &(Any + Send + 'static)) {
|
||||
let d = format!("{:?}", payload);
|
||||
let s = if let Some(s) = payload.downcast_ref::<String>() {
|
||||
&s
|
||||
} else if let Some(s) = payload.downcast_ref::<&str>() {
|
||||
s
|
||||
} else {
|
||||
// "PAYLOAD IS NOT A STRING"
|
||||
d.as_str()
|
||||
};
|
||||
println!("{}: PANIC OCCURRED: {}", ctx, s);
|
||||
}
|
||||
|
||||
pub fn start() {
|
||||
panic::set_hook(Box::new(|panic_info| {
|
||||
print_panic_payload("set_hook", panic_info.payload());
|
||||
if let Some(location) = panic_info.location() {
|
||||
println!("LOCATION: {}:{}", location.file(), location.line());
|
||||
} else {
|
||||
println!("NO LOCATION INFORMATION");
|
||||
}
|
||||
}));
|
||||
|
||||
let database_url = env::var("DATABASE_URL")
|
||||
.expect("DATABASE_URL must be set");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user