Skip to content

Commit

Permalink
Change to only logging when unable to parse user agent
Browse files Browse the repository at this point in the history
segiddins authored and simi committed Feb 21, 2024
1 parent ba422e5 commit 0c48ef3
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/events/recordable.rb
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ def record_event!(tag, request: Current.request, **additional)
begin
user_agent_info = Gemcutter::UserAgentParser.call(user_agent)
additional[:user_agent_info] = user_agent_info
rescue Gemcutter::UserAgentParser::UnableToParse => e
Rails.error.report(e, context: { user_agent: }, handled: true)
rescue Gemcutter::UserAgentParser::UnableToParse
nil
end
end

2 changes: 2 additions & 0 deletions lib/gemcutter/user_agent_parser.rb
Original file line number Diff line number Diff line change
@@ -33,6 +33,8 @@ def call(user_agent, exclusive: false)

return ret if ret

logger.warn("No parser could parse the user agent", user_agent: user_agent)

raise UnableToParse, "No parser could parse the user agent"
end
end

0 comments on commit 0c48ef3

Please sign in to comment.