diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index ad0a94e..0400583 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -537,9 +537,10 @@ async fn client_loop( let connection_data = scope .create_userdata_ref_mut(&mut lua_player)?; + /* TODO: Instead of panicking we ought to send a message to the player + * and the console log, and abandon execution. */ lua.load( - std::fs::read(&file_name) - .expect(format!("Failed to load script file {}!", &file_name).as_str()), + std::fs::read(&file_name).unwrap_or_else(|_| panic!("Failed to load script file {}!", &file_name)), ) .set_name("@".to_string() + &file_name) .exec()?; @@ -643,10 +644,10 @@ async fn client_loop( lua.scope(|scope| { let connection_data = scope .create_userdata_ref_mut(&mut lua_player)?; - + /* TODO: Instead of panicking we ought to send a message to the player + * and the console log, and abandon execution. */ lua.load( - std::fs::read(&file_name) - .expect(format!("Failed to load script file {}!", &file_name).as_str()), + std::fs::read(&file_name).unwrap_or_else(|_| panic!("Failed to load script file {}!", &file_name)), ) .set_name("@".to_string() + &file_name) .exec()?;