Diff

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
parent 4289:de91b7cb7342
child 4292:c13b8003ee5c
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