mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-11 21:40:17 +02:00
Correctly throw ApiInvalidError when API key deleted (222)
Do not assume keys are invalid on unrecognized codes. Closes #574
This commit is contained in:
parent
dc4b4bbdf5
commit
b4dc624b17
@ -46,7 +46,4 @@ class UpdateKeyForm(forms.Form):
|
||||
raise forms.ValidationError(str(e))
|
||||
except evelink.api.APIError as e:
|
||||
logger.debug("Got error code %s while validating API %s" % (e.code, self.cleaned_data['api_id']))
|
||||
if int(e.code) in [221, 222]:
|
||||
raise forms.ValidationError("API key failed validation")
|
||||
else:
|
||||
raise forms.ValidationError("Failed to reach API servers")
|
||||
raise forms.ValidationError('Error while checking API key (%s)' % e.code)
|
||||
|
@ -321,13 +321,11 @@ class EveApiManager:
|
||||
info = EveApiManager.get_api_info(api_id, api_key).result
|
||||
chars = EveApiManager.get_characters_from_api(api_id, api_key).result
|
||||
except evelink.api.APIError as e:
|
||||
if int(e.code) in [221, 222]:
|
||||
raise e
|
||||
raise EveApiManager.ApiInvalidError(api_id)
|
||||
if int(e.code) == 222:
|
||||
raise EveApiManager.ApiInvalidError(api_id)
|
||||
raise e
|
||||
except (requests.exceptions.RequestExeception, HTTPError, URLError) as e:
|
||||
raise EveApiManager.ApiServerUnreachableError(e)
|
||||
except Exception:
|
||||
raise EveApiManager.ApiInvalidError(api_id)
|
||||
auth, c = AuthServicesInfo.objects.get_or_create(user=user)
|
||||
states = [auth.state]
|
||||
from authentication.tasks import determine_membership_by_character # circular import issue
|
||||
|
Loading…
x
Reference in New Issue
Block a user