Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Commit 6fcb831

Browse files
committed
refactor(init): attempt to catch module errors from invalid installs
Since people continue to drag and drop updates without clearing old files, then spend days or weeks complaining about script errors.
1 parent f5396ed commit 6fcb831

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

init.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ local function loadModule(self, module)
5252
local fn, err = load(chunk, ('@@ox_lib/imports/%s/%s.lua'):format(module, context))
5353

5454
if not fn or err then
55-
return error(('\n^1Error importing module (%s): %s^0'):format(dir, err), 3)
55+
if shared then
56+
lib.print.warn(("An error occurred when importing '@ox_lib/imports/%s'.\nThis is likely caused by improperly updating ox_lib.\n%s'")
57+
:format(module, err))
58+
fn, err = load(shared, ('@@ox_lib/imports/%s/shared.lua'):format(module))
59+
end
60+
61+
if not fn or err then
62+
return error(('\n^1Error importing module (%s): %s^0'):format(dir, err), 3)
63+
end
5664
end
5765

5866
local result = fn()

0 commit comments

Comments
 (0)