Mercurial > prosody-modules
comparison mod_sentry/sentry.lib.lua @ 4291:a0d20e378670
mod_sentry: Pull default message from error text or wrapped error (if string)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 09 Dec 2020 22:23:49 +0000 |
| parents | de91b7cb7342 |
| children | c13b8003ee5c |
comparison
equal
deleted
inserted
replaced
| 4290:2c73544e33ea | 4291:a0d20e378670 |
|---|---|
| 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); | 135 e = error_to_sentry_exception(e); |
| 136 if not self.event.message then | |
| 137 if e.text then | |
| 138 self:message(e.text); | |
| 139 elseif type(e.context.wrapped_error) == "string" then | |
| 140 self:message(e.context.wrapped_error); | |
| 141 end | |
| 142 end | |
| 136 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 |
| 137 e = error_to_sentry_exception(errors.coerce(nil, e)); | 144 e = error_to_sentry_exception(errors.coerce(nil, e)); |
| 138 end | 145 end |
| 139 | 146 |
| 140 local exception = self.event.exception; | 147 local exception = self.event.exception; |
