Maybe make CodeQL happy about this exception handling

This commit is contained in:
Trenton Holmes 2022-03-11 12:39:40 -08:00
parent e2303235cd
commit dc657f2eb0

View File

@ -56,9 +56,9 @@ class MatchingModelSerializer(serializers.ModelSerializer):
):
try:
re.compile(match)
except Exception as e:
except re.error as e:
raise serializers.ValidationError(
_("Invalid regular expression: %(error)s") % {"error": str(e)},
_("Invalid regular expression: %(error)s") % {"error": str(e.msg)},
)
return match