Exception: Plurimath::Math::ParseError
- Inherits:
-
StandardError
- Object
- StandardError
- Plurimath::Math::ParseError
- Defined in:
- lib/plurimath/errors/parse_error.rb
Instance Method Summary collapse
- #generic_part ⇒ Object
-
#initialize(text, type) ⇒ ParseError
constructor
A new instance of ParseError.
- #parsing_message ⇒ Object
- #unitsml_message ⇒ Object
Constructor Details
#initialize(text, type) ⇒ ParseError
Returns a new instance of ParseError.
6 7 8 9 10 |
# File 'lib/plurimath/errors/parse_error.rb', line 6 def initialize(text, type) @text = text @type = type.to_sym super(@type == :invalid_unitsml ? : ) end |
Instance Method Details
#generic_part ⇒ Object
31 32 33 34 35 36 |
# File 'lib/plurimath/errors/parse_error.rb', line 31 def generic_part <<~MESSAGE.rstrip [plurimath] If this is a bug, please report the formula at our issue tracker at: [plurimath] https://github.com/plurimath/plurimath/issues MESSAGE end |
#parsing_message ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/plurimath/errors/parse_error.rb', line 12 def <<~MESSAGE [plurimath] Error: Failed to parse the following formula with type `#{@type}`. [plurimath] Please first manually validate the formula. #{generic_part} ---- FORMULA BEGIN ---- #{@text} ---- FORMULA END ---- MESSAGE end |
#unitsml_message ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/plurimath/errors/parse_error.rb', line 23 def <<~MESSAGE [plurimath] Invalid formula `#{@text}`. [plurimath] The use of a variable as an exponent is not valid. #{generic_part} MESSAGE end |