Provide feedback when ESI errors occur.

Closes #620
This commit is contained in:
Adarnof
2017-01-13 21:56:27 -05:00
parent 73641a7a1e
commit 24bc9d4b7f
4 changed files with 63 additions and 27 deletions

View File

@@ -16,6 +16,7 @@ from notifications import notify
from django.utils import timezone
from authentication.decorators import members_and_blues
from esi.clients import esi_client_factory
from bravado.exception import HTTPError
import uuid
import logging
@@ -255,8 +256,12 @@ def srp_request_view(request, fleet_srp):
messages.error(request,
"Your SRP request Killmail link is invalid. Please make sure you are using zKillboard.")
return redirect("auth_srp_management_view")
c = esi_client_factory()
srp_ship_name = c.Universe.get_universe_types_type_id(type_id=srp_kill_data).result()['type_name']
try:
c = esi_client_factory()
srp_ship_name = c.Universe.get_universe_types_type_id(type_id=srp_kill_data).result()['type_name']
except HTTPError as e:
messages.error(request, str(e))
return redirect('auth_dashboard')
srp_request.srp_ship_name = srp_ship_name
kb_total_loss = ship_value
srp_request.kb_total_loss = kb_total_loss