Exception: VisionAPI::TaskFailedError

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

Overview

An async task came back failed. A failed task costs 0 credits.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_id, error) ⇒ TaskFailedError

Returns a new instance of TaskFailedError.



136
137
138
139
140
141
142
# File 'lib/vision_api/errors.rb', line 136

def initialize(task_id, error)
  error ||= {}
  @task_id = task_id
  @code = error["code"] || "unknown"
  @details = error["details"] || {}
  super("Task #{task_id} failed — #{@code}: #{error["message"] || "no detail"}")
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



134
135
136
# File 'lib/vision_api/errors.rb', line 134

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



134
135
136
# File 'lib/vision_api/errors.rb', line 134

def details
  @details
end

#task_idObject (readonly)

Returns the value of attribute task_id.



134
135
136
# File 'lib/vision_api/errors.rb', line 134

def task_id
  @task_id
end