MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / __init__

Method __init__

gui/esiFittings.py:232–263  ·  view source on GitHub ↗
(self, ex)

Source from the content-addressed store, hash-verified

230class ESIExceptionHandler:
231 # todo: make this a generate excetpion handler for all calls
232 def __init__(self, ex):
233 # raise ex
234 if ex.response['error'].startswith('Token is not valid') \
235 or ex.response['error'] == 'invalid_token' \
236 or ex.response['error'] == 'invalid_grant': # todo: this seems messy, figure out a better response
237 pyfalog.error(ex)
238 with wx.MessageDialog(
239 gui.mainFrame.MainFrame.getInstance(),
240 _t("There was an error validating characters' SSO token. Please try "
241 "logging into the character again to reset the token."),
242 _t("Invalid Token"),
243 wx.OK | wx.ICON_ERROR | wx.CANCEL
244 ) as dlg:
245 dlg.SetOKLabel("Manage ESI Characters")
246 ret = dlg.ShowModal()
247 if ret == wx.ID_OK:
248 SsoCharacterMgmt.openOne(parent=gui.mainFrame.MainFrame.getInstance())
249 # todo: spawn manage esi characters
250 pass
251 elif ex.response['error'].startswith('Timeout contacting'):
252 pyfalog.error(ex)
253 with wx.MessageDialog(
254 gui.mainFrame.MainFrame.getInstance(),
255 "HTTP %s: %s\n\n" % (ex.status_code, ex.response['error'])
256 + _t("The server took too long to response. Please try again in a moment."),
257 _t("Timeout"),
258 wx.OK | wx.ICON_ERROR
259 ) as dlg:
260 dlg.ShowModal()
261 else:
262 # We don't know how to handle the error, raise it for the global error handler to pick it up
263 raise ex
264
265
266class ExportToEve(AuxiliaryFrame):

Callers

nothing calls this directly

Calls 3

_tFunction · 0.50
getInstanceMethod · 0.45
openOneMethod · 0.45

Tested by

no test coverage detected