diff --git a/lib/bugsnag/cleaner.rb b/lib/bugsnag/cleaner.rb index 238e04bd..33d0cd09 100644 --- a/lib/bugsnag/cleaner.rb +++ b/lib/bugsnag/cleaner.rb @@ -30,16 +30,18 @@ def clean_url(url) begin uri = URI(url) + + if uri.is_a?(URI::MailTo) + clean_mailto_url(url, uri) + else + clean_generic_url(url, uri) + end rescue URI::InvalidURIError pre_query_string, _query_string = url.split('?', 2) - return "#{pre_query_string}?#{FILTERED}" - end - - if uri.is_a?(URI::MailTo) - clean_mailto_url(url, uri) - else - clean_generic_url(url, uri) + "#{pre_query_string}?#{FILTERED}" + rescue StandardError + FILTERED end end