Module: HumanistErrors
- Defined in:
- lib/humanist_errors.rb,
lib/humanist_errors/color.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 =
"Hi!\n"- ENDING_TOKEN =
"Here's the error from Ruby: \n"- MESSAGE_DICTIONARY =
YAML.load(File.read(File.('../../dictionaries/humanist_errors.en.yml', __FILE__)))
- VERSION =
"1.0.5"- 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], /syntax error, unexpected tIDENTIFIER/ => MESSAGE_DICTIONARY[:syntax_error][:t_identifier], /.*/ => :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 ], load_error: HumanistErrors::RegexHash[ /no such file to load/ => MESSAGE_DICTIONARY[:load_error][:no_file], /.*/ => :no_result ] }
Instance Method Summary collapse
Instance Method Details
#with_human_errors ⇒ Object
13 14 15 16 |
# File 'lib/humanist_errors.rb', line 13 def with_human_errors require 'humanist_errors/monkey' yield end |