Class: Sparkql::ErrorsProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/sparkql/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors = []) ⇒ ErrorsProcessor

Returns a new instance of ErrorsProcessor.



6
7
8
# File 'lib/sparkql/errors.rb', line 6

def initialize( errors = [] )
  @errors = Array(errors)
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



4
5
6
# File 'lib/sparkql/errors.rb', line 4

def errors
  @errors
end

Instance Method Details

#dropped_errors?Boolean

true if there is at least one :dropped error in the error stack

Returns:

  • (Boolean)


29
30
31
# File 'lib/sparkql/errors.rb', line 29

def dropped_errors?
  errors_by_status? :dropped
end

#errors?Boolean

true if the error stack contains at least one error

Returns:

  • (Boolean)


11
12
13
# File 'lib/sparkql/errors.rb', line 11

def errors?
  @errors.size > 0
end

#errors_by_status?(status) ⇒ Boolean

true if there is at least one error of status :status in the error stack

Returns:

  • (Boolean)


16
17
18
19
20
21
# File 'lib/sparkql/errors.rb', line 16

def errors_by_status?( status )
  @errors.each do | error |
    return true if status == error.status
  end
  false
end

#fatal_errors?Boolean

true if there is at least one :fatal error in the error stack

Returns:

  • (Boolean)


24
25
26
# File 'lib/sparkql/errors.rb', line 24

def fatal_errors?
  errors_by_status? :fatal
end

#recovered_errors?Boolean

true if there is at least one :recovered error in the error stack

Returns:

  • (Boolean)


34
35
36
# File 'lib/sparkql/errors.rb', line 34

def recovered_errors?
  errors_by_status? :recovered
end