Class: Slack::Errors
- Inherits:
-
Object
- Object
- Slack::Errors
- Defined in:
- lib/slack-wrapper/errors.rb
Instance Method Summary collapse
- #handle(object) ⇒ Object
-
#initialize(object) ⇒ Errors
constructor
A new instance of Errors.
- #message(object) ⇒ Object
Constructor Details
#initialize(object) ⇒ Errors
Returns a new instance of Errors.
3 4 5 |
# File 'lib/slack-wrapper/errors.rb', line 3 def initialize(object) handle(object) end |
Instance Method Details
#handle(object) ⇒ Object
6 7 8 |
# File 'lib/slack-wrapper/errors.rb', line 6 def handle(object) raise RuntimeError, (object) end |
#message(object) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/slack-wrapper/errors.rb', line 9 def (object) case object['error'] when nil error = "Undefined Error" when "not_authed" object['detail'] = "Invalid Token, check configuration" when String error = object['error'] end case object['detail'] when nil detail = "Details unknown" when String detail = object['detail'] end "Error '#{error}' occured. Details: #{detail}" end |