diff --git a/src/lune/builtins/net/mod.rs b/src/lune/builtins/net/mod.rs index b5733cb..79e026d 100644 --- a/src/lune/builtins/net/mod.rs +++ b/src/lune/builtins/net/mod.rs @@ -146,10 +146,12 @@ where // a oneshot channel since we move the sender // into our table with the stop function let (shutdown_tx, mut shutdown_rx) = mpsc::channel::<()>(1); - let server_request_callback = lua.create_registry_value(config.handle_request)?; + let server_request_callback = lua + .create_registry_value(config.handle_request) + .expect("Failed to store request handler in registry - out of memory"); let server_websocket_callback = config.handle_web_socket.map(|handler| { lua.create_registry_value(handler) - .expect("Failed to store websocket handler") + .expect("Failed to store websocket handler in registry - out of memory") }); let sched = lua .app_data_ref::<&Scheduler>() diff --git a/src/lune/globals/require/context.rs b/src/lune/globals/require/context.rs index e27a483..761a5f7 100644 --- a/src/lune/globals/require/context.rs +++ b/src/lune/globals/require/context.rs @@ -199,7 +199,7 @@ impl<'lua> RequireContext<'lua> { let multi_key = self .lua .create_registry_value(multi_vec) - .expect("Failed to store require result in registry"); + .expect("Failed to store require result in registry - out of memory"); Ok(multi_key) } } @@ -299,7 +299,7 @@ impl<'lua> RequireContext<'lua> { let multi_key = self .lua .create_registry_value(multi_vec) - .expect("Failed to store require result in registry"); + .expect("Failed to store require result in registry - out of memory"); Ok(multi_key) } }, diff --git a/src/lune/scheduler/impl_runner.rs b/src/lune/scheduler/impl_runner.rs index 440c02b..674b283 100644 --- a/src/lune/scheduler/impl_runner.rs +++ b/src/lune/scheduler/impl_runner.rs @@ -66,14 +66,14 @@ where let stored = match res { Err(e) => Err(e), Ok(v) => Ok(Arc::new( - self.lua - .create_registry_value(v.into_vec()) - .expect("Failed to store return values in registry"), + self.lua.create_registry_value(v.into_vec()).expect( + "Failed to store thread results in registry - out of memory", + ), )), }; sender .send(stored) - .expect("Failed to broadcast return values of thread"); + .expect("Failed to broadcast thread results"); } } } diff --git a/src/lune/scheduler/impl_threads.rs b/src/lune/scheduler/impl_threads.rs index dc5a2f8..165a37b 100644 --- a/src/lune/scheduler/impl_threads.rs +++ b/src/lune/scheduler/impl_threads.rs @@ -47,7 +47,7 @@ where let thread = thread.into_lua_thread(self.lua)?; let args = LuaMultiValue::new(); // Will be resumed with error, don't need real args - let thread = SchedulerThread::new(self.lua, thread, args)?; + let thread = SchedulerThread::new(self.lua, thread, args); let thread_id = thread.id(); self.state.set_thread_error(thread_id, err); @@ -78,7 +78,7 @@ where let thread = thread.into_lua_thread(self.lua)?; let args = args.into_lua_multi(self.lua)?; - let thread = SchedulerThread::new(self.lua, thread, args)?; + let thread = SchedulerThread::new(self.lua, thread, args); let thread_id = thread.id(); self.threads @@ -116,7 +116,7 @@ where let thread = thread.into_lua_thread(self.lua)?; let args = args.into_lua_multi(self.lua)?; - let thread = SchedulerThread::new(self.lua, thread, args)?; + let thread = SchedulerThread::new(self.lua, thread, args); let thread_id = thread.id(); self.threads diff --git a/src/lune/scheduler/thread.rs b/src/lune/scheduler/thread.rs index 301bd0f..ed8d083 100644 --- a/src/lune/scheduler/thread.rs +++ b/src/lune/scheduler/thread.rs @@ -57,22 +57,22 @@ impl SchedulerThread { lua: &'lua Lua, thread: LuaThread<'lua>, args: LuaMultiValue<'lua>, - ) -> LuaResult { + ) -> Self { let args_vec = args.into_vec(); let thread_id = SchedulerThreadId::from(&thread); let key_thread = lua .create_registry_value(thread) - .context("Failed to store value in registry")?; + .expect("Failed to store thread in registry - out of memory"); let key_args = lua .create_registry_value(args_vec) - .context("Failed to store value in registry")?; + .expect("Failed to store thread args in registry - out of memory"); - Ok(Self { + Self { thread_id, key_thread, key_args, - }) + } } /**