Exception: Crowdkit::StatusError

Inherits:
UserError show all
Defined in:
lib/crowdkit/error.rb

Instance Method Summary collapse

Methods inherited from UserError

#generate_message

Constructor Details

#initialize(status, timed_out_after = nil) ⇒ StatusError

Returns a new instance of StatusError.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/crowdkit/error.rb', line 38

def initialize(status, timed_out_after = nil)
  if timed_out_after
    reason = "timed out"
    message = "it did not complete after #{timed_out_after} seconds"
  else
    reason = status.state == "killed" ? "was killed" : "failed"
    message = status.message
  end
  super(
    generate_message(
      :problem => "There was a problem while processing your request in the background.",
      :summary => "The process #{reason} because of: #{message}.",
      :resolution => "Try performing the operation again."
    )
  )
end