pyfa-org / Pyfa

Python fitting assistant, cross-platform fitting tool for EVE Online
GNU General Public License v3.0
1.6k stars 406 forks source link

Uncaught Exception in service\esiAccess: HTTP Error 403: Get request canceled #1618

Open WatchMeCalculate opened 6 years ago

WatchMeCalculate commented 6 years ago

Bug Report

Expected behavior:

Fetch ESI fits and have them listed.

Actual behavior:

During fetching fits, received Exception view

Detailed steps to reproduce:

Open ESI Fittings and fetch fits. It only happened to me once, and i've been attempting to reproduce it in various ways,

Release or development git branch? Please note the release version or commit hash:

Current master 2.0.2 something

Operating system and version (eg: Windows 10, OS X 10.9, OS X 10.11, Ubuntu 16.10):

Win 10

Other relevant information:

[2018-05-30 04:53:59.695775] INFO: service.esiAccess: Refreshing token for <character>
[2018-05-30 04:55:47.634763] CRITICAL: gui.errorDialog: 

Traceback (most recent call last):
  File "D:\Github\Pyfa\gui\esiFittings.py", line 123, in fetchFittings
    ESIExceptionHandler(self, ex)
  File "D:\Github\Pyfa\gui\esiFittings.py", line 172, in __init__
    raise ex
  File "D:\Github\Pyfa\gui\esiFittings.py", line 110, in fetchFittings
    self.fittings = sEsi.getFittings(self.getActiveCharacter())
  File "D:\Github\Pyfa\service\esi.py", line 92, in getFittings
    resp = super().getFittings(char)
  File "D:\Github\Pyfa\service\esiAccess.py", line 119, in getFittings
    return self.get(char, ESIEndpoints.CHAR_FITTINGS, character_id=char.characterID)
  File "D:\Github\Pyfa\service\esiAccess.py", line 274, in get
    return self._after_request(self._session.get("{}{}".format(self.esi_url, endpoint)))
  File "D:\Github\Pyfa\service\esiAccess.py", line 266, in _after_request
    resp.json()
service.esiAccess.APIException: HTTP Error 403: Get https://login.eveonline.com/oauth/verify: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
WatchMeCalculate commented 6 years ago

Exception gets caught and re raised in gui\esiFittings.py#L172 I just hit fetch fits again and it successfully worked. What's the philosophy on users seeing errors? Could just write traceback to logs and show a dialog to say try again?

blitzmann commented 6 years ago

What's the philosophy on users seeing errors?

Generally the user should see some kind of information on why the call failed. Maybe the status code, message, and a blurb that says try again.

There isn't any proper HTTP error handling for ESI yet - most of the time I spent on it was devoted to getting it to work correctly in the first place. The ESI post fit has some error handling, but generally just to tell the user if the fit was created or not. It's kind of half-assed.

There's also an exception handler thing that specifically looks for an invalid token error, and displays a custom error message. We could use this to capture known errors to display custom information, or default to a generic error (while printing out to log the actual error). See the ESIExceptionHandler class.

That being said, we also have to be aware that there's ESI-specific errors, and literal HTTP request errors. I haven't looked into differentiating the two.

As for the error you got, it looks like an HTTP request timeout. This seems to happen occasionally with ESI when it goes down (for server downtime, general maintenance, etc).