Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

InfluxDBClient.request discards error details when raising exception #533

Closed
thomir opened this issue Oct 30, 2017 · 2 comments
Closed

InfluxDBClient.request discards error details when raising exception #533

thomir opened this issue Oct 30, 2017 · 2 comments

Comments

@thomir
Copy link

thomir commented Oct 30, 2017

The InfluxDBClient.request method contains code to make a request to the influxdb server that looks like this:

    while retry:
            try:
                response = self._session.request(...)
                break
            except requests.exceptions.ConnectionError as e:
                _try += 1
                if self._retries != 0:
                    retry = _try < self._retries
        else:
            raise requests.exceptions.ConnectionError

The problem is that if we fail to connect, the ConnectionError that is raised does not have any of the information about what actually failed, making it really hard to debug from the exception message.

A possibly alternative might be something like this:

    while retry:
            try:
                response = self._session.request(...)
                break
            except requests.exceptions.ConnectionError as e:
                _try += 1
                if self._retries != 0:
                    retry = _try < self._retries
                if not retry:
                    raise

This will re-raise the exception that caused the failure, with the contextual information about what actually happened.

@thomir thomir changed the title InfluxDBClient.request discards error detailswhen raising exception InfluxDBClient.request discards error details when raising exception Oct 30, 2017
@xginn8
Copy link
Collaborator

xginn8 commented Nov 8, 2017

i believe this was fixed in #508, can you confirm that? you may need to run from HEAD, as this change hasn't made it into a release yet.

@thomir
Copy link
Author

thomir commented Nov 8, 2017

I can confirm that it's fixed in #508, thanks.

@thomir thomir closed this as completed Nov 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants