Class: XiWechatCorp::API::RaiseClientError

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/xi_wechat_corp/api/connection.rb

Instance Method Summary collapse

Instance Method Details

#parse(body) ⇒ Object

Raises:



18
19
20
21
# File 'lib/xi_wechat_corp/api/connection.rb', line 18

def parse(body)
  raise ClientError.new(body) if body.nil? || (body.key?('errcode') && body['errcode'].to_i != 0)
  body
end