class OAuth2::Error

def initialize(response)

response might be a Response object, or the response.parsed hash
'invalid_request', 'invalid_client', 'invalid_token', 'invalid_grant', 'unsupported_grant_type', 'invalid_scope'
standard error codes include:
def initialize(response)
  @response = response
  if response.respond_to?(:parsed)
    if response.parsed.is_a?(Hash)
      @code = response.parsed['error']
      @description = response.parsed['error_description']
    end
  elsif response.is_a?(Hash)
    @code = response['error']
    @description = response['error_description']
  end
  @body = if response.respond_to?(:body)
            response.body
          else
            @response
          end
  message_opts = parse_error_description(@code, @description)
  super(error_message(@body, message_opts))
end