Skip to content

Conversation

@kelseymorris95
Copy link
Contributor

@kelseymorris95 kelseymorris95 commented Aug 11, 2016

Add NetworkResponse to BoxAPIException

@boxcla
Copy link

boxcla commented Aug 11, 2016

Verified that @kelseymorris95 has signed the CLA. Thanks for the pull request!

@Jeff-Meadows
Copy link
Contributor

lgtm to push once the other PR is approved.

👍

Kelsey Morris added 2 commits August 17, 2016 13:43
url=url,
method=method,
context_info=response_json.get('context_info', None),
request_response=network_response.request_response,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unnecessary backwards incompatibility, since custom networks might not have request_response.

Instead, I would propose that this line be:

network_response=network_response

This has the benefits of:

  • Is backwards compatible.
  • Works with custom subclasses of NetworkResponse.
  • Still allows the user to access network_response.request_response, if network_response is an instance of DefaultNetworkResponse.
  • Not tying us to the requests library even further.
  • Probably never again needing to add more fields to the exception, since we now include a maximal amount of information.

We could also avoid adding access_token_used, since the user could use exception.network_response.access_token_used instead. It's a minor difference, we could do either. Having it directly on the object is slightly more clear and direct and less work for the user to access, but is another property that we would have to maintain forever for backwards compatibility.

@jmoldow
Copy link
Contributor

jmoldow commented Aug 18, 2016

👍 , waiting for tests to pass.

@jmoldow jmoldow merged commit 768efc0 into master Aug 18, 2016
@jmoldow jmoldow deleted the extra_exception_info branch August 18, 2016 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants