Exception: Taski::AggregateError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/taski.rb

Overview

Raised when multiple tasks fail during parallel execution

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ AggregateError



125
126
127
128
# File 'lib/taski.rb', line 125

def initialize(errors)
  @errors = errors
  super(build_message)
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



122
123
124
# File 'lib/taski.rb', line 122

def errors
  @errors
end

Instance Method Details

#causeException?

Returns the first error for compatibility with exception chaining



132
133
134
# File 'lib/taski.rb', line 132

def cause
  errors.first&.error
end

#includes?(exception_class) ⇒ Boolean

Check if this aggregate contains an error of the given type



139
140
141
# File 'lib/taski.rb', line 139

def includes?(exception_class)
  errors.any? { |f| f.error.is_a?(exception_class) }
end