Sha256: 2d84153ebca6fc300f3b944da436efe42cf68ff0bfcc715fd4f963989c335f58

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

  class HandcuffsError < StandardError; end

  class RequiresPhaseArgumentError < HandcuffsError
    def initialize(task)
      msg = <<-MESSAGE
        rake #{task} requires a phase argument.
        For example: #{task}[pre_restart]
      MESSAGE
      super(msg)
    end
  end

  class HandcuffsNotConfiguredError < HandcuffsError
    def initialize
      msg = <<-MESSAGE
        You must configure Handcuffs in your Rails initializer.
        see README.md for details
      MESSAGE
      super(msg)
    end
  end

  class HandcuffsUnknownPhaseError < HandcuffsError
    def initialize(phase, phases)
      msg = <<-MESSAGE
        Unknown phase #{phase.to_s}
        Handcuffs is configured to allow #{phases.to_sentence}
      MESSAGE
      super msg
    end
  end

  class HandcuffsPhaseUndeclaredError < HandcuffsError
    def initialize(found_phases, allowed_phases)
      msg = <<-MESSAGE
        found declarations for #{found_phases.to_sentence}
        but only #{allowed_phases.to_sentence} are allowed
      MESSAGE
      super msg
    end
  end

  class HandcuffsPhaseOutOfOrderError < HandcuffsError
    def initialize(not_run_phase, attempted_phase)
      msg = <<-MESSAGE
        You tried to run #{attempted_phase.to_s}, but #{not_run_phase.to_s} has not been run
      MESSAGE
      super msg
    end
  end

  class HandcuffsPhaseUndefinedError < HandcuffsError
    def initialize(undefined_phases)
      msg = <<-MESSAGE
        The following migrations do not have a phase defined
      #{undefined_phases.to_sentence}
      MESSAGE
      super msg
    end
  end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
handcuffs-2.1.0 lib/handcuffs/errors.rb
handcuffs-2.0.0 lib/handcuffs/errors.rb