Skip to content

Commit

Permalink
Simplify messages with no stack or locals.
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Jul 21, 2018
1 parent cb6bfc1 commit cc5904e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,18 @@ do
end
addon.ColorLocals = colorLocals

local errorFormat = "%dx %s\n\nLocals:\n%s"
local errorFormat = "%dx %s"
local errorFormatLocals = "%dx %s\n\nLocals:\n%s"
function addon:FormatError(err)
local s = colorStack(tostring(err.message) .. "\n" .. tostring(err.stack))
local l = colorLocals(tostring(err.locals))
return errorFormat:format(err.counter or -1, s, l)
if not err.locals then
local s = colorStack(tostring(err.message) .. (err.stack and "\n"..tostring(err.stack) or ""))
local l = colorLocals(tostring(err.locals))
return errorFormat:format(err.counter or -1, s, l)
else
local s = colorStack(tostring(err.message) .. (err.stack and "\n"..tostring(err.stack) or ""))
local l = colorLocals(tostring(err.locals))
return errorFormatLocals:format(err.counter or -1, s, l)
end
end
end

Expand Down

0 comments on commit cc5904e

Please sign in to comment.