summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-12-14 07:08:01 -0300
committerAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-12-14 07:08:01 -0300
commit41ad47dde24d5de05bc3bdd8bb1633efeb391043 (patch)
treefa2a11a2f32b34e3336b6b6d1415e25f754d528d
parent933579435b29d52c373441a86025c36bee1f3219 (diff)
downloadhighline-41ad47dde24d5de05bc3bdd8bb1633efeb391043.tar.gz
Improve HighLine::CustomErrors documentation
-rw-r--r--lib/highline/custom_errors.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/highline/custom_errors.rb b/lib/highline/custom_errors.rb
index 860414f..2d45687 100644
--- a/lib/highline/custom_errors.rb
+++ b/lib/highline/custom_errors.rb
@@ -2,34 +2,52 @@ 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