Add status messages back to ESI fitting export (#1502)

This commit is contained in:
blitzmann
2018-05-21 23:36:40 -04:00
parent 9f69c76380
commit eaae51f8d8
2 changed files with 16 additions and 14 deletions

View File

@@ -243,28 +243,30 @@ class ExportToEve(wx.Frame):
self.statusbar.SetStatusText("Sending request and awaiting response", 1)
sEsi = Esi.getInstance()
sFit = Fit.getInstance()
data = sPort.exportESI(sFit.getFit(fitID))
res = sEsi.postFitting(self.getActiveCharacter(), data)
try:
sFit = Fit.getInstance()
data = sPort.exportESI(sFit.getFit(fitID))
res = sEsi.postFitting(self.getActiveCharacter(), data)
res.raise_for_status()
self.statusbar.SetStatusText("", 0)
self.statusbar.SetStatusText("", 1)
# try:
# text = json.loads(res.text)
# self.statusbar.SetStatusText(text['message'], 1)
# except ValueError:
# pyfalog.warning("Value error on loading JSON.")
# self.statusbar.SetStatusText("", 1)
self.statusbar.SetStatusText(res.reason, 1)
except requests.exceptions.ConnectionError:
msg = "Connection error, please check your internet connection"
pyfalog.error(msg)
self.statusbar.SetStatusText(msg)
self.statusbar.SetStatusText("ERROR", 0)
self.statusbar.SetStatusText(msg, 1)
except ESIExportException as ex:
pyfalog.error(ex)
self.statusbar.SetStatusText("ERROR", 0)
self.statusbar.SetStatusText(ex.args[0], 1)
self.statusbar.SetStatusText("{} - {}".format(res.status_code, res.reason), 1)
except APIException as ex:
ESIExceptionHandler(self, ex)
try:
ESIExceptionHandler(self, ex)
except Exception as ex:
self.statusbar.SetStatusText("ERROR", 0)
self.statusbar.SetStatusText("{} - {}".format(res.status_code, res.reason), 1)
pyfalog.error(ex)
class SsoCharacterMgmt(wx.Dialog):

View File

@@ -96,7 +96,7 @@ class Esi(EsiAccess):
# @todo: new fitting ID can be recovered from resp.data,
char = self.getSsoCharacter(id)
resp = super().postFitting(char, json_str)
return resp.json()
return resp
def delFitting(self, id, fittingID):
char = self.getSsoCharacter(id)