Module: HumanistErrors
- Defined in:
- lib/humanist_errors.rb,
lib/humanist_errors/colors.rb,
lib/humanist_errors/search.rb,
lib/humanist_errors/version.rb,
lib/humanist_errors/regex_hash.rb,
lib/humanist_errors/error_mapper.rb,
lib/humanist_errors/exception_extensions.rb
Defined Under Namespace
Modules: ExceptionExtensions Classes: Color, RegexHash, Search
Constant Summary collapse
- STARTING_TOKEN =
color.green("Hi!\n")
- ENDING_TOKEN =
color.green("Here's the error from Ruby: \n")
- MESSAGE_DICTIONARY =
YAML.load(File.read(File.('../../dictionaries/humanist_errors.en.yml', __FILE__)))
- VERSION =
"1.0.3"- ERROR_MAPPER =
{ syntax_error: HumanistErrors::RegexHash[ /syntax error, unexpected ';'/ => MESSAGE_DICTIONARY[:syntax_error][:unexpected_semi_colon], /unterminated string meets end of file/ => MESSAGE_DICTIONARY[:syntax_error][:open_quote], /unterminated quoted string meets end of file/ => MESSAGE_DICTIONARY[:syntax_error][:string_formatter], /syntax error, unexpected end-of-input, expecting keyword_end/ => MESSAGE_DICTIONARY[:syntax_error][:missing_block_closer], /syntax error, unexpected end-of-input/ => MESSAGE_DICTIONARY[:syntax_error][:missing_argument], /.*/ => :no_result ], no_method_error: HumanistErrors::RegexHash[ /undefined method `.*' for nil:NilClass/ => MESSAGE_DICTIONARY[:no_method_error][:undefined_method_for_nil], /.*/ => :no_result ], name_error: HumanistErrors::RegexHash[ /undefined local variable or method `.*'/ => MESSAGE_DICTIONARY[:name_error][:undefined_word], /.*/ => :no_result ], zero_division_error: HumanistErrors::RegexHash[ /divided by 0/ => MESSAGE_DICTIONARY[:zero_division_error][:divide_by_zero], /.*/ => :no_result ] }
Instance Method Summary collapse
Instance Method Details
#with_human_errors ⇒ Object
14 15 16 17 |
# File 'lib/humanist_errors.rb', line 14 def with_human_errors require 'humanist_errors/monkey' yield end |