Sha256: 2438bc4bdb8509718aff2e008db0dcef528dd52aa0497e2bcb6ee9fc384f9f45

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

  class HandcuffsError < StandardError; end

  class RequiresPhaseArgumentError < HandcuffsError
    def initialize(task)
      msg = <<-MESSAGE
        rake #{task} requires a phase argument.
        For example: #{task}[pre_deploy]
      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 HandcuffsPhaseOutOfOrderError < HandcuffsError
    def initialize(not_run_phase, attempted_phase)
      msg = <<-MESSAGE
        Your 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

3 entries across 3 versions & 1 rubygems

Version Path
handcuffs-1.0.2 lib/handcuffs/errors.rb
handcuffs-1.0.1 lib/handcuffs/errors.rb
handcuffs-1.0.0 lib/handcuffs/errors.rb