1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
# frozen_string_literal: true
module Delayer
class Error < ::StandardError; end
class TooLate < Error; end
class AlreadyExecutedError < TooLate; end
class AlreadyCanceledError < TooLate; end
class AlreadyRunningError < TooLate; end
class InvalidPriorityError < Error; end
class RecursiveError < Error; end
class NoLowerLevelError < RecursiveError; end
class RemainJobsError < RecursiveError; end
def self.StateError(state)
case state
when :run
AlreadyRunningError
when :done
AlreadyExecutedError
when :cancel
AlreadyCanceledError
else
TooLate
end
end
end
|