Sha256: f8e26662932e9a860db70d9d52973c3bcf634d80ee47fe97ee1da1c33fe2f682

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

class HighLine

  # Internal HighLine errors.
  module CustomErrors
    # An error that responds to :explanation_key
    class ExplainableError < StandardError
      # Explanation key as Symbol or nil. Used to
      # select the proper error message to be displayed.
      # @return [nil, Symbol] explanation key to get the
      #   proper error message.
      def explanation_key
        nil
      end
    end

    # Bare Question error
    class QuestionError < ExplainableError
      # (see ExplainableError#explanation_key)
      def explanation_key
        nil
      end
    end

    # Invalid Question error
    class NotValidQuestionError < ExplainableError
      # (see ExplainableError#explanation_key)
      def explanation_key
        :not_valid
      end
    end

    # Out of Range Question error
    class NotInRangeQuestionError < ExplainableError
      # (see ExplainableError#explanation_key)
      def explanation_key
        :not_in_range
      end
    end

    # Unconfirmed Question error
    class NoConfirmationQuestionError < ExplainableError
      # (see ExplainableError#explanation_key)
      def explanation_key
        nil
      end
    end

    # Unavailable auto complete error
    class NoAutoCompleteMatch < ExplainableError
      # (see ExplainableError#explanation_key)
      def explanation_key
        :no_completion
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
highline-2.0.0.pre.develop.9 lib/highline/custom_errors.rb
highline-2.0.0.pre.develop.6 lib/highline/custom_errors.rb
highline-2.0.0.pre.develop.4 lib/highline/custom_errors.rb