Class: Maze::ErrorCaptor

Inherits:
Object
  • Object
show all
Defined in:
lib/maze/error_captor.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#captured_errorsObject (readonly)

Returns the value of attribute captured_errors.



5
6
7
# File 'lib/maze/error_captor.rb', line 5

def captured_errors
  @captured_errors
end

Class Method Details

.add(report) ⇒ Object

Sets the last error report that BugSnag has captured

Parameters:

  • report (Bugsnag::Report)

    The report to set



12
13
14
# File 'lib/maze/error_captor.rb', line 12

def add(report)
  captured_errors << report
end

.captured_errorsObject



42
43
44
# File 'lib/maze/error_captor.rb', line 42

def captured_errors
  @captured_errors ||= []
end

.classesArray<String>

Returns an array of the primary error classes of captured error reports

Returns:

  • (Array<String>)

    The error classes



19
20
21
# File 'lib/maze/error_captor.rb', line 19

def classes
  captured_errors.map { |report| report.summary[:error_class] }
end

.empty?Boolean

Whether any error reports exist in the current context

Returns:

  • (Boolean)

    Whether a report exists



38
39
40
# File 'lib/maze/error_captor.rb', line 38

def empty?
  captured_errors.empty?
end

.messagesArray<String>

Returns the primary error messages of the captured error reports

Returns:

  • (Array<String>)

    The error messages



26
27
28
# File 'lib/maze/error_captor.rb', line 26

def messages
  captured_errors.map { |report| report.summary[:message] }
end

.resetObject

Resets the captured errors array



31
32
33
# File 'lib/maze/error_captor.rb', line 31

def reset
  @captured_errors = []
end