Sha256: 3c8bf7b5a7bb268b925df0f44f72efe7e6eb2598fa3684a8776d24334be02334
Contents?: true
Size: 661 Bytes
Versions: 32
Compression:
Stored size: 661 Bytes
Contents
module Telegram module Bot module Exceptions class ResponseError < Base attr_reader :response def initialize(response) @response = response end def to_s super + format(' (%s)', data.map { |k, v| %(#{k}: "#{v}") }.join(', ')) end def error_code data[:error_code] || data['error_code'] end private def data @data ||= begin JSON.parse(response.body) rescue JSON::ParserError { error_code: response.status, uri: response.env.url.to_s } end end end end end end
Version data entries
32 entries across 32 versions & 2 rubygems