mod_sentry/sentry.lib.lua
changeset 4296 c13b8003ee5c
parent 4295 a0d20e378670
child 4999 cb3de818ff55
equal deleted inserted replaced
4295:a0d20e378670 4296: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;