Sha256: 106d93a7853633a0fd28e79111a1a8144228fb439d7d094c9b9008943b9b53cf
Contents?: true
Size: 670 Bytes
Versions: 3
Compression:
Stored size: 670 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.request.last_uri.to_s } end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems