Improve error handling in network module by suppressing Lua's error message when loading the socket module. This change enhances the user experience by preventing unnecessary error output while maintaining fallback functionality.
This commit is contained in:
@@ -6,10 +6,10 @@ local utils = require("utils")
|
|||||||
-- Try to load socket module, fallback to basic implementation for LuaJIT
|
-- Try to load socket module, fallback to basic implementation for LuaJIT
|
||||||
local socket
|
local socket
|
||||||
local socket_available = true
|
local socket_available = true
|
||||||
|
-- Try to load socket module, ignore Lua's error message
|
||||||
local ok, err = pcall(function() socket = require("socket") end)
|
local ok, err = pcall(function() socket = require("socket") end)
|
||||||
if not ok then
|
if not ok then
|
||||||
print("Warning: socket module not available, using fallback implementation")
|
print("Warning: socket module not available, using fallback implementation")
|
||||||
print("Error:", err)
|
|
||||||
socket_available = false
|
socket_available = false
|
||||||
-- Create a minimal socket fallback for LuaJIT
|
-- Create a minimal socket fallback for LuaJIT
|
||||||
socket = {
|
socket = {
|
||||||
|
|||||||
Reference in New Issue
Block a user