Suboptimal error message for creating a bad workflow
When creating a workflow without specifying a workspace and using a non-existent template name (`bad`), the error message is not very helpful. printf "{}" | debusine --server debusine.freexian.com create-workflow bad results in --- result: failure error: title: Error The error log has more (after wrapping it): ERROR: Server exception. status_code: 400 detail: None traceback: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/debusine/server/views/workflows.py", line 125, in post serializer.is_valid(raise_exception=True) File "/usr/lib/python3/dist-packages/rest_framework/serializers.py", line 227, in is_valid self._validated_data = self.run_validation(self.initial_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/rest_framework/serializers.py", line 426, in run_validation value = self.to_internal_value(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/rest_framework/serializers.py", line 483, in to_internal_value validated_value = field.run_validation(primitive_value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/rest_framework/relations.py", line 153, in run_validation return super().run_validation(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/rest_framework/fields.py", line 544, in run_validation (is_empty_value, data) = self.validate_empty_values(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/rest_framework/fields.py", line 520, in validate_empty_values return (True, self.get_default()) ^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/rest_framework/fields.py", line 497, in get_default return self.default() ^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/debusine/db/models/workspaces.py", line 218, in default_workspace return Workspace.objects.get( ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 637, in get raise self.model.DoesNotExist( debusine.db.models.workspaces.Workspace.DoesNotExist: Workspace matching query does not exist. If we do the same with a valid `--workflow`, the workflow actually gets created despite its data being invalid. A work request is generated and it can be viewed. The web view will then show the validation failure. Ideally, the workflow is being validated before allocating and returning a work request.
issue