Exception: Lookout::Reception::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/lookout-3.0/reception/error.rb

Overview

Error raised when a method is received too many times.

Class Method Summary collapse

Class Method Details

.from(reception, calls, range) ⇒ Error

Returns A new error with a suitable error message for the RECEPTION of a method, where CALLS is outside the RANGE of expected calls.

Parameters:

Returns:

  • (Error)

    A new error with a suitable error message for the RECEPTION of a method, where CALLS is outside the RANGE of expected calls.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lookout-3.0/reception/error.rb', line 11

def from(reception, calls, range)
  new('%s: unexpected number of invocations (%d for %s)' %
      [reception,
       calls,
       if range.begin == range.end
         range.begin
       elsif range.end == 1.0/0
         '%d..' % range.begin
       else
         range
       end])
end