Comparison

mod_sentry/sentry.lib.lua @ 4292:c13b8003ee5c

mod_sentry: Pull message from error *before* we mutate it into something different...
author Matthew Wild <mwild1@gmail.com>
date Wed, 09 Dec 2020 22:32:31 +0000
parent 4291:a0d20e378670
child 4995:cb3de818ff55
comparison
equal deleted inserted replaced
4291:a0d20e378670 4292:c13b8003ee5c
130 return self:set("message", { formatted = text }); 130 return self:set("message", { formatted = text });
131 end 131 end
132 132
133 function sentry_event_methods:add_exception(e) 133 function sentry_event_methods:add_exception(e)
134 if errors.is_err(e) then 134 if errors.is_err(e) then
135 e = error_to_sentry_exception(e);
136 if not self.event.message then 135 if not self.event.message then
137 if e.text then 136 if e.text then
138 self:message(e.text); 137 self:message(e.text);
139 elseif type(e.context.wrapped_error) == "string" then 138 elseif type(e.context.wrapped_error) == "string" then
140 self:message(e.context.wrapped_error); 139 self:message(e.context.wrapped_error);
141 end 140 end
142 end 141 end
142 e = error_to_sentry_exception(e);
143 elseif type(e) ~= "table" or not (e.type and e.value) then 143 elseif type(e) ~= "table" or not (e.type and e.value) then
144 e = error_to_sentry_exception(errors.coerce(nil, e)); 144 e = error_to_sentry_exception(errors.coerce(nil, e));
145 end 145 end
146 146
147 local exception = self.event.exception; 147 local exception = self.event.exception;