Skip to content

Commit

Permalink
Access error details through StreamAPIException class attr_readers (#56)
Browse files Browse the repository at this point in the history
* add accessors and to_s to StreamAPIException class

* remove resonse attr reader, and add json_response?
  • Loading branch information
reachire-smendola authored Oct 21, 2021
1 parent 3675c56 commit ccbe440
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/stream-chat/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

module StreamChat
class StreamAPIException < StandardError
attr_reader :error_code
attr_reader :error_message

def initialize(response)
super()
@response = response
Expand All @@ -24,6 +27,14 @@ def message
"StreamChat error HTTP code: #{@response.status}"
end
end

def json_response?
@json_response
end

def to_s
message
end
end

class StreamChannelException < StandardError; end
Expand Down

0 comments on commit ccbe440

Please sign in to comment.