Skip to content

Commit 6461d38

Browse files
committed
Better error messages for failures.
1 parent ebe4521 commit 6461d38

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ApiLoader.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ local function loadApiImplementations(a_Options, a_Api, a_Logger)
298298
-- Load all files specified in options:
299299
for _, fnam in ipairs(a_Options.apiImplementationFiles) do
300300
a_Logger:debug("Loading API implementation file \"%s\".", fnam)
301-
local f = assert(loadfile(fnam))
302-
local impl = f()
301+
local apifile = assert(loadfile(fnam))
302+
local impl = apifile()
303303
assert(type(impl) == "table", "API Implementation must return a dictionary-table")
304304
for k, v in pairs(impl) do
305305
if (type(v) == "function") then

Simulator.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ function Simulator:classInheritsFrom(a_ChildName, a_ParentName)
353353
-- Check the inheritance using the child class API:
354354
local childClass = self.sandbox[a_ChildName]
355355
if not(childClass) then
356-
self.logger:warning("Attempting to check inheritance for non-existent class \"%s\".", a_ChildName)
356+
self.logger:warning("Attempting to check inheritance for non-existent class \"%s\".\n%s", a_ChildName, debug.traceback())
357357
return false
358358
end
359359
local childApi = childClass.simulatorInternal_ClassApi or {}
@@ -1165,7 +1165,7 @@ function Simulator:injectApi(a_ApiDesc)
11651165

11661166
-- Failed to create the endpoint, chain to previous __index or raise an error:
11671167
if not(prevIndex) then
1168-
self.logger:warning("Attempting to use an unknown Global value \"%s\", nil will be returned", a_SymbolName)
1168+
self.logger:warning("Attempting to use an unknown Global value \"%s\", nil will be returned.\n%s", a_SymbolName, debug.traceback())
11691169
return nil
11701170
end
11711171
assert(type(prevIndex) == "function") -- We don't support table-based __index yet (but can be done)

0 commit comments

Comments
 (0)