Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: catch additional XLSForm validation errors during deployment #5419

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion kpi/serializers/v2/deployment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from django.conf import settings
from pyxform.errors import PyXFormError
from pyxform.validators.enketo_validate import EnketoValidateError
from pyxform.validators.odk_validate import ODKValidateError
from rest_framework import serializers
from xlsxwriter.exceptions import DuplicateWorksheetName

Expand Down Expand Up @@ -36,7 +38,12 @@ def create(self, validated_data):
# 'deployed' boolean value
try:
asset.deploy(backend=backend_id, active=validated_data.get('active', False))
except (DuplicateWorksheetName, PyXFormError) as e:
except (
DuplicateWorksheetName,
EnketoValidateError,
PyXFormError,
ODKValidateError,
) as e:
raise serializers.ValidationError({'error': str(e)})
return asset.deployment

Expand Down
Loading