Sha256: 6f24865b2a72054250df74f8830358072231bc4cc60d119d6fd9bd4ff4d6232b
Contents?: true
Size: 726 Bytes
Versions: 13
Compression:
Stored size: 726 Bytes
Contents
module Bugsnag::Middleware class SuggestionData CAPTURE_REGEX = /Did you mean\?([\s\S]+)$/ DELIMITER = "\n" def initialize(bugsnag) @bugsnag = bugsnag end def call(report) matches = [] report.raw_exceptions.each do |exception| match = CAPTURE_REGEX.match(exception.message) next unless match suggestions = match.captures[0].split(DELIMITER) matches.concat suggestions.map{ |suggestion| suggestion.strip } end if matches.size == 1 report.add_tab(:error, {:suggestion => matches.first}) elsif matches.size > 1 report.add_tab(:error, {:suggestions => matches}) end @bugsnag.call(report) end end end
Version data entries
13 entries across 13 versions & 1 rubygems