File: error.rb

package info (click to toggle)
ruby-delayer 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: ruby: 947; sh: 4; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 628 bytes parent folder | download
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