Module: ErrorHandling
- Defined in:
- lib/utils/error_handling.rb
Overview
Module handles all errors and messages to be raised by gem
Class Method Summary collapse
- .raise_too_many_args_error ⇒ Object
- .undefined_endpoint(endpoint) ⇒ Object
- .unnamed_resource_args ⇒ Object
Class Method Details
.raise_too_many_args_error ⇒ Object
4 5 6 |
# File 'lib/utils/error_handling.rb', line 4 def raise_too_many_args_error raise ArgumentError, 'Too many arguments given; search pokedex using either :id or :name' end |
.undefined_endpoint(endpoint) ⇒ Object
13 14 15 16 |
# File 'lib/utils/error_handling.rb', line 13 def undefined_endpoint(endpoint) msg = "Undefined endpoint; '#{endpoint}' not defined by https://pokeapi.co/" raise ArgumentError, msg end |
.unnamed_resource_args ⇒ Object
8 9 10 11 |
# File 'lib/utils/error_handling.rb', line 8 def unnamed_resource_args msg = 'Too many arguments given; Only call get with a single symbol or a key-value pair' raise ArgumentError, msg end |