mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-20 03:19:24 +02:00
Update name
This commit is contained in:
parent
820d6f3f58
commit
2ba62bf174
3 changed files with 8 additions and 12 deletions
|
@ -16,7 +16,7 @@ from dateutil.relativedelta import relativedelta # type: ignore
|
|||
from epplibwrapper.errors import ErrorCode, RegistryError
|
||||
from registrar.models import Contact, Domain, DomainApplication, DraftDomain, User, Website
|
||||
from registrar.utility import csv_export
|
||||
from registrar.utility.errors import ApplicationStatusError, FSMErrorCodes
|
||||
from registrar.utility.errors import FSMApplicationError, FSMErrorCodes
|
||||
from registrar.views.utility.mixins import OrderableFieldsMixin
|
||||
from django.contrib.admin.views.main import ORDER_VAR
|
||||
from registrar.widgets import NoAutocompleteFilteredSelectMultiple
|
||||
|
@ -167,9 +167,9 @@ class DomainApplicationAdminForm(forms.ModelForm):
|
|||
error_message = None
|
||||
if investigator is None:
|
||||
# Lets grab the error message from a common location
|
||||
error_message = ApplicationStatusError.get_error_message(FSMErrorCodes.NO_INVESTIGATOR)
|
||||
error_message = FSMApplicationError.get_error_message(FSMErrorCodes.NO_INVESTIGATOR)
|
||||
elif not investigator.is_staff:
|
||||
error_message = ApplicationStatusError.get_error_message(FSMErrorCodes.INVESTIGATOR_NOT_STAFF)
|
||||
error_message = FSMApplicationError.get_error_message(FSMErrorCodes.INVESTIGATOR_NOT_STAFF)
|
||||
else:
|
||||
is_valid = True
|
||||
|
||||
|
@ -1225,11 +1225,11 @@ class DomainApplicationAdmin(ListHeaderAdmin):
|
|||
obj.status = original_obj.status
|
||||
|
||||
# Try to perform the status change.
|
||||
# Catch ApplicationStatusError's and return the message,
|
||||
# Catch FSMApplicationError's and return the message,
|
||||
# as these are typically user errors.
|
||||
try:
|
||||
selected_method()
|
||||
except ApplicationStatusError as err:
|
||||
except FSMApplicationError as err:
|
||||
logger.warning(f"An error encountered when trying to change status: {err}")
|
||||
error_message = err.message
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from django.db import models
|
|||
from django_fsm import FSMField, transition # type: ignore
|
||||
from django.utils import timezone
|
||||
from registrar.models.domain import Domain
|
||||
from registrar.utility.errors import ApplicationStatusError, FSMErrorCodes
|
||||
from registrar.utility.errors import FSMApplicationError, FSMErrorCodes
|
||||
|
||||
from .utility.time_stamped_model import TimeStampedModel
|
||||
from ..utility.email import send_templated_email, EmailSendingError
|
||||
|
@ -791,7 +791,7 @@ class DomainApplication(TimeStampedModel):
|
|||
|
||||
# == Check that the application is valid == #
|
||||
if Domain.objects.filter(name=self.requested_domain.name).exists():
|
||||
raise ApplicationStatusError(code=FSMErrorCodes.APPROVE_DOMAIN_IN_USE)
|
||||
raise FSMApplicationError(code=FSMErrorCodes.APPROVE_DOMAIN_IN_USE)
|
||||
|
||||
# == Create the domain and related components == #
|
||||
created_domain = Domain.objects.create(name=self.requested_domain.name)
|
||||
|
|
|
@ -71,8 +71,6 @@ class GenericError(Exception):
|
|||
return self._error_mapping.get(code)
|
||||
|
||||
|
||||
# (Q for reviewers) What should this be called?
|
||||
# Not a fan of this name.
|
||||
class FSMErrorCodes(IntEnum):
|
||||
"""Used when doing FSM transitions.
|
||||
Overview of generic error codes:
|
||||
|
@ -88,9 +86,7 @@ class FSMErrorCodes(IntEnum):
|
|||
INVESTIGATOR_NOT_SUBMITTER = 4
|
||||
|
||||
|
||||
# (Q for reviewers) What should this be called?
|
||||
# Not a fan of this name.
|
||||
class ApplicationStatusError(Exception):
|
||||
class FSMApplicationError(Exception):
|
||||
"""
|
||||
Used to raise exceptions when doing FSM Transitions.
|
||||
Uses `FSMErrorCodes` as an enum.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue