Skip to content

Commit dddd619

Browse files
authored
fix: catch additional XLSForm validation errors during deployment (#5419)
### 📣 Summary Enhanced error handling to catch more validation errors in XLSForm during deployment. ### 📖 Description Validation error handling for XLSForm deployment has been enhanced to catch a wider range of issues. This prevents the display of a generic 500 error in the deployment modal and instead returns the explicit error message. ### Notes Supersedes #5417, #5411 and #5403
1 parent 9189ac9 commit dddd619

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

kpi/serializers/v2/deployment.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from django.conf import settings
22
from pyxform.errors import PyXFormError
3+
from pyxform.validators.enketo_validate import EnketoValidateError
4+
from pyxform.validators.odk_validate import ODKValidateError
35
from rest_framework import serializers
46
from xlsxwriter.exceptions import DuplicateWorksheetName
57

@@ -36,7 +38,12 @@ def create(self, validated_data):
3638
# 'deployed' boolean value
3739
try:
3840
asset.deploy(backend=backend_id, active=validated_data.get('active', False))
39-
except (DuplicateWorksheetName, PyXFormError) as e:
41+
except (
42+
DuplicateWorksheetName,
43+
EnketoValidateError,
44+
PyXFormError,
45+
ODKValidateError,
46+
) as e:
4047
raise serializers.ValidationError({'error': str(e)})
4148
return asset.deployment
4249

0 commit comments

Comments
 (0)