Sha256: dc139a5d54a347401e31e5b6afc0c12183dca2c5c18fe9b3c3a50522c6f310dd
Contents?: true
Size: 759 Bytes
Versions: 11
Compression:
Stored size: 759 Bytes
Contents
# frozen_string_literal: true # lib/errors.rb module StreamChat class StreamAPIException < StandardError def initialize(response) super() @response = response p response begin parsed_response = JSON.parse(response.body) @json_response = true @error_code = parsed_response.fetch('code', 'unknown') @error_message = parsed_response.fetch('message', 'unknown') rescue JSON::ParserError @json_response = false end end def message if @json_response "StreamChat error code #{@error_code}: #{@error_message}" else "StreamChat error HTTP code: #{@response.status}" end end end class StreamChannelException < StandardError; end end
Version data entries
11 entries across 11 versions & 1 rubygems