Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting X-FluidDB-* headers is awkward #1

Open
terrycojones opened this issue Jul 16, 2012 · 4 comments · Fixed by #2
Open

Getting X-FluidDB-* headers is awkward #1

terrycojones opened this issue Jul 16, 2012 · 4 comments · Fixed by #2
Assignees
Milestone

Comments

@terrycojones
Copy link
Member

When an API call results in an error, the FluidError instance has the FluidResponse received in args[0] and one can get at the headers from the response via err.args[0].response.headers (where err is the FluidError instance).

It would be nice if the X-FluidDB-* error headers were more easily accessible. Similarly, the request id is in err.args[0].request_id and could be promoted to more prominence in FluidError.

@ntoll
Copy link
Member

ntoll commented Jul 16, 2012

How about simply making the references: err.headers and err.request_id..?

@ghost ghost assigned ntoll Jul 16, 2012
@terrycojones
Copy link
Member Author

Here's a sample of what err.args[0].response.headers can be expected to contain for any intrepid test writer:

{
  'x-fluiddb-message': "Action 'read' not possible on category 'namespaces'.",
  'transfer-encoding': 'chunked',
  'x-fluiddb-request-id': 'API-9007-20120716-132434-468215',
  'server': 'nginx/0.7.65',
  'connection': 'keep-alive', 
  'date': 'Mon, 16 Jul 2012 13:24:34 GMT',
  'x-fluiddb-error-class': 'TBadRequest',
  'content-type': 'text/html'
}

@terrycojones
Copy link
Member Author

@ntoll: sounds good!

@terrycojones
Copy link
Member Author

Just using self.response = response in FluidError would make things more explicit (rather than relying on the user to know that Python exceptions have an args list).

@ntoll ntoll mentioned this issue Jul 16, 2012
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 a pull request may close this issue.

2 participants