changeset 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 2c73544e33ea
children c13b8003ee5c
files mod_sentry/sentry.lib.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_sentry/sentry.lib.lua	Wed Dec 09 16:30:21 2020 +0000
+++ b/mod_sentry/sentry.lib.lua	Wed Dec 09 22:23:49 2020 +0000
@@ -133,6 +133,13 @@
 function sentry_event_methods:add_exception(e)
 	if errors.is_err(e) then
 		e = error_to_sentry_exception(e);
+		if not self.event.message then
+			if e.text then
+				self:message(e.text);
+			elseif type(e.context.wrapped_error) == "string" then
+				self:message(e.context.wrapped_error);
+			end
+		end
 	elseif type(e) ~= "table" or not (e.type and e.value) then
 		e = error_to_sentry_exception(errors.coerce(nil, e));
 	end