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.



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

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

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



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

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)


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

def dropped_errors?
  errors_by_status? :dropped
end

#errors?Boolean

true if the error stack contains at least one error

Returns:

  • (Boolean)


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

def errors?
  @errors.size.positive?
end

#errors_by_status?(status) ⇒ Boolean

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

Returns:

  • (Boolean)


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

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)


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

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)


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

def recovered_errors?
  errors_by_status? :recovered
end