Skip to content

Commit ccbe440

Browse files
Access error details through StreamAPIException class attr_readers (#56)
* add accessors and to_s to StreamAPIException class * remove resonse attr reader, and add json_response?
1 parent 3675c56 commit ccbe440

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/stream-chat/errors.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
module StreamChat
66
class StreamAPIException < StandardError
7+
attr_reader :error_code
8+
attr_reader :error_message
9+
710
def initialize(response)
811
super()
912
@response = response
@@ -24,6 +27,14 @@ def message
2427
"StreamChat error HTTP code: #{@response.status}"
2528
end
2629
end
30+
31+
def json_response?
32+
@json_response
33+
end
34+
35+
def to_s
36+
message
37+
end
2738
end
2839

2940
class StreamChannelException < StandardError; end

0 commit comments

Comments
 (0)