Skip to content
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
7 changes: 7 additions & 0 deletions src/sentry/services/hybrid_cloud/import_export/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import traceback

import sentry_sdk
from django.core.exceptions import ValidationError as DjangoValidationError
from django.core.serializers import deserialize, serialize
from django.core.serializers.base import DeserializationError
Expand Down Expand Up @@ -325,6 +326,7 @@ def import_by_model(
)

except DeserializationError:
sentry_sdk.capture_exception()
return RpcImportError(
kind=RpcImportErrorKind.DeserializationFailed,
on=InstanceID(model_name),
Expand All @@ -349,6 +351,7 @@ def import_by_model(
)
return existing_import_chunk
except Exception:
sentry_sdk.capture_exception()
return RpcImportError(
kind=RpcImportErrorKind.Unknown,
on=InstanceID(model_name),
Expand All @@ -358,20 +361,23 @@ def import_by_model(
# All non-`ImportChunk`-related kinds of `IntegrityError` mean that the user's data was
# not properly sanitized against collision. This could be the fault of either the import
# logic, or the user's data itself.
sentry_sdk.capture_exception()
return RpcImportError(
kind=RpcImportErrorKind.IntegrityError,
on=InstanceID(model_name),
reason=str(e),
)

except DatabaseError as e:
sentry_sdk.capture_exception()
return RpcImportError(
kind=RpcImportErrorKind.DatabaseError,
on=InstanceID(model_name),
reason=str(e),
)

except Exception:
sentry_sdk.capture_exception()
return RpcImportError(
kind=RpcImportErrorKind.Unknown,
on=InstanceID(model_name),
Expand Down Expand Up @@ -509,6 +515,7 @@ def yield_objects():
)

except Exception:
sentry_sdk.capture_exception()
return RpcExportError(
kind=RpcExportErrorKind.Unknown,
on=InstanceID(model_name),
Expand Down