5
5
6
6
import traceback
7
7
8
+ import sentry_sdk
8
9
from django .core .exceptions import ValidationError as DjangoValidationError
9
10
from django .core .serializers import deserialize , serialize
10
11
from django .core .serializers .base import DeserializationError
@@ -325,6 +326,7 @@ def import_by_model(
325
326
)
326
327
327
328
except DeserializationError :
329
+ sentry_sdk .capture_exception ()
328
330
return RpcImportError (
329
331
kind = RpcImportErrorKind .DeserializationFailed ,
330
332
on = InstanceID (model_name ),
@@ -349,6 +351,7 @@ def import_by_model(
349
351
)
350
352
return existing_import_chunk
351
353
except Exception :
354
+ sentry_sdk .capture_exception ()
352
355
return RpcImportError (
353
356
kind = RpcImportErrorKind .Unknown ,
354
357
on = InstanceID (model_name ),
@@ -358,20 +361,23 @@ def import_by_model(
358
361
# All non-`ImportChunk`-related kinds of `IntegrityError` mean that the user's data was
359
362
# not properly sanitized against collision. This could be the fault of either the import
360
363
# logic, or the user's data itself.
364
+ sentry_sdk .capture_exception ()
361
365
return RpcImportError (
362
366
kind = RpcImportErrorKind .IntegrityError ,
363
367
on = InstanceID (model_name ),
364
368
reason = str (e ),
365
369
)
366
370
367
371
except DatabaseError as e :
372
+ sentry_sdk .capture_exception ()
368
373
return RpcImportError (
369
374
kind = RpcImportErrorKind .DatabaseError ,
370
375
on = InstanceID (model_name ),
371
376
reason = str (e ),
372
377
)
373
378
374
379
except Exception :
380
+ sentry_sdk .capture_exception ()
375
381
return RpcImportError (
376
382
kind = RpcImportErrorKind .Unknown ,
377
383
on = InstanceID (model_name ),
@@ -509,6 +515,7 @@ def yield_objects():
509
515
)
510
516
511
517
except Exception :
518
+ sentry_sdk .capture_exception ()
512
519
return RpcExportError (
513
520
kind = RpcExportErrorKind .Unknown ,
514
521
on = InstanceID (model_name ),
0 commit comments