mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
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.
This commit is contained in:
10
init.lua
10
init.lua
@@ -52,7 +52,15 @@ local function loadModule(self, module)
|
||||
local fn, err = load(chunk, ('@@ox_lib/imports/%s/%s.lua'):format(module, context))
|
||||
|
||||
if not fn or err then
|
||||
return error(('\n^1Error importing module (%s): %s^0'):format(dir, err), 3)
|
||||
if shared then
|
||||
lib.print.warn(("An error occurred when importing '@ox_lib/imports/%s'.\nThis is likely caused by improperly updating ox_lib.\n%s'")
|
||||
:format(module, err))
|
||||
fn, err = load(shared, ('@@ox_lib/imports/%s/shared.lua'):format(module))
|
||||
end
|
||||
|
||||
if not fn or err then
|
||||
return error(('\n^1Error importing module (%s): %s^0'):format(dir, err), 3)
|
||||
end
|
||||
end
|
||||
|
||||
local result = fn()
|
||||
|
||||
Reference in New Issue
Block a user