diff options
-rw-r--r-- | lib/lace/error.lua | 8 | ||||
-rw-r--r-- | test/test-lace.error.lua | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/lace/error.lua b/lib/lace/error.lua index 0ad0df6..2dc7cdb 100644 --- a/lib/lace/error.lua +++ b/lib/lace/error.lua @@ -71,8 +71,8 @@ end -- @treturn table The error table (mutated with the source information). -- @function augment local function _augment(err, source, linenr) - err.source = source - err.linenr = linenr + err.words.source = source + err.words.linenr = linenr return err end @@ -102,9 +102,9 @@ local function _render(err) -- The first line is the error message local ret = { err.msg } -- The second is the source filename and line - ret[2] = err.source.source .. " :: " .. tostring(err.linenr) + ret[2] = err.words.source.source .. " :: " .. tostring(err.words.linenr) -- The third line is the line of the input - local srcline = err.source.lines[err.linenr] or { + local srcline = err.words.source.lines[err.words.linenr] or { original = "???", content = { {spos = 1, epos = 3, str = "???"} } } ret[3] = srcline.original diff --git a/test/test-lace.error.lua b/test/test-lace.error.lua index 6f7d995..a2e09a7 100644 --- a/test/test-lace.error.lua +++ b/test/test-lace.error.lua @@ -52,8 +52,8 @@ function suite.error_augmentation() local src = {} local aug = error.augment(err, src, 10) assert(aug == err, "Augmentation should return the error") - assert(err.source == src, "Augmented errors should contain their source data") - assert(err.linenr == 10, "Augmented errors should contain their error line") + assert(err.words.source == src, "Augmented errors should contain their source data") + assert(err.words.linenr == 10, "Augmented errors should contain their error line") end function suite.error_render() |