|
@@ -1,7 +1,7 @@
|
|
|
from __future__ import absolute_import
|
|
|
|
|
|
+import six
|
|
|
from django.db import IntegrityError, transaction
|
|
|
-
|
|
|
from rest_framework.response import Response
|
|
|
|
|
|
from sentry import features
|
|
@@ -77,8 +77,8 @@ class GroupIntegrationDetailsEndpoint(GroupEndpoint):
|
|
|
organization_id=organization_id,
|
|
|
)
|
|
|
)
|
|
|
- except IntegrationError as exc:
|
|
|
- return Response({"detail": exc.message}, status=400)
|
|
|
+ except IntegrationError as e:
|
|
|
+ return Response({"detail": six.text_type(e)}, status=400)
|
|
|
|
|
|
# was thinking put for link an existing issue, post for create new issue?
|
|
|
def put(self, request, group, integration_id):
|
|
@@ -108,8 +108,8 @@ class GroupIntegrationDetailsEndpoint(GroupEndpoint):
|
|
|
data = installation.get_issue(external_issue_id, data=request.data)
|
|
|
except IntegrationFormError as exc:
|
|
|
return Response(exc.field_errors, status=400)
|
|
|
- except IntegrationError as exc:
|
|
|
- return Response({"non_field_errors": [exc.message]}, status=400)
|
|
|
+ except IntegrationError as e:
|
|
|
+ return Response({"non_field_errors": [six.text_type(e)]}, status=400)
|
|
|
|
|
|
defaults = {
|
|
|
"title": data.get("title"),
|
|
@@ -140,8 +140,8 @@ class GroupIntegrationDetailsEndpoint(GroupEndpoint):
|
|
|
installation.after_link_issue(external_issue, data=request.data)
|
|
|
except IntegrationFormError as exc:
|
|
|
return Response(exc.field_errors, status=400)
|
|
|
- except IntegrationError as exc:
|
|
|
- return Response({"non_field_errors": [exc.message]}, status=400)
|
|
|
+ except IntegrationError as e:
|
|
|
+ return Response({"non_field_errors": [six.text_type(e)]}, status=400)
|
|
|
|
|
|
try:
|
|
|
with transaction.atomic():
|
|
@@ -192,8 +192,8 @@ class GroupIntegrationDetailsEndpoint(GroupEndpoint):
|
|
|
data = installation.create_issue(request.data)
|
|
|
except IntegrationFormError as exc:
|
|
|
return Response(exc.field_errors, status=400)
|
|
|
- except IntegrationError as exc:
|
|
|
- return Response({"non_field_errors": [exc.message]}, status=400)
|
|
|
+ except IntegrationError as e:
|
|
|
+ return Response({"non_field_errors": [six.text_type(e)]}, status=400)
|
|
|
|
|
|
external_issue_key = installation.make_external_key(data)
|
|
|
external_issue, created = ExternalIssue.objects.get_or_create(
|