Exception: Yay::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Yay::Error
- Defined in:
- lib/yay/errors.rb
Overview
the base class for errors in yay. this provides error reporting in a friendly way (who likes stack traces?)
Direct Known Subclasses
AlreadyAssignedError, BadFilenameError, CircularReferenceError, CouldntFindFileError, InstallFailedError, NotAllowedError, TooManyColoursError, UnexpectedTokenError, UnresolvedSubstitutionError
Instance Attribute Summary collapse
-
#position ⇒ Object
readonly
Returns the value of attribute position.
Instance Method Summary collapse
-
#printable_message ⇒ Object
override this to provide user feedback.
-
#printable_position ⇒ Object
a generic representation of the error’s location on the line, file, etc.
Instance Attribute Details
#position ⇒ Object (readonly)
Returns the value of attribute position.
6 7 8 |
# File 'lib/yay/errors.rb', line 6 def position @position end |
Instance Method Details
#printable_message ⇒ Object
override this to provide user feedback
9 10 11 |
# File 'lib/yay/errors.rb', line 9 def raise "Unimplemented printable error" end |
#printable_position ⇒ Object
a generic representation of the error’s location on the line, file, etc
14 15 16 17 18 19 20 21 |
# File 'lib/yay/errors.rb', line 14 def printable_position array = @position return "" unless @position return " in file #{array[2]}, line #{array[1]}, word #{array[0]}" if array[2] return " on line #{array[1]}, word #{array[0]}" if array[1] return " at word #{array[0]}" if array[0] raise "junk position given to exception" end |