Skip to content

Commit

Permalink
Fix uncaught EUI() exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
kbirkeland authored and jimfunk committed Dec 13, 2023
1 parent 135fe60 commit a4cb4cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions netfields/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def to_python(self, value):

try:
return EUI(value, dialect=mac_unix_common)
except AddrFormatError as e:
except (AddrFormatError, IndexError, TypeError) as e:
raise ValidationError(e)

def get_prep_value(self, value):
Expand Down Expand Up @@ -238,7 +238,7 @@ def to_python(self, value):

try:
return EUI(value, dialect=mac_eui64)
except AddrFormatError as e:
except (AddrFormatError, IndexError, TypeError) as e:
raise ValidationError(e)

def get_prep_value(self, value):
Expand Down
4 changes: 2 additions & 2 deletions netfields/rest_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def to_internal_value(self, data):
return data
try:
return EUI(data, dialect=mac_unix_common)
except (AddrFormatError, TypeError):
except (AddrFormatError, IndexError, TypeError):
self.fail('invalid')


Expand All @@ -93,7 +93,7 @@ def to_internal_value(self, data):
return data
try:
return EUI(data, dialect=mac_eui64)
except (AddrFormatError, TypeError):
except (AddrFormatError, IndexError, TypeError):
self.fail('invalid')


Expand Down

0 comments on commit a4cb4cb

Please sign in to comment.