test
This commit is contained in:
parent
a4db37adfa
commit
b8c9b51f29
|
|
@ -217,7 +217,23 @@ public function process(Import $import, ?Authenticatable $user = null): array
|
|||
|
||||
if ($isPg) {
|
||||
// Establish a savepoint so a failing row does not poison the whole transaction
|
||||
DB::statement('SAVEPOINT import_row_'.$rowNum);
|
||||
try {
|
||||
DB::statement('SAVEPOINT import_row_'.$rowNum);
|
||||
} catch (\Throwable $se) {
|
||||
ImportEvent::create([
|
||||
'import_id' => $import->id,
|
||||
'user_id' => $user?->getAuthIdentifier(),
|
||||
'event' => 'savepoint_failed',
|
||||
'level' => 'error',
|
||||
'message' => 'Failed to create savepoint; transaction already aborted.',
|
||||
'context' => [
|
||||
'row_number' => $rowNum,
|
||||
'exception' => $this->exceptionContext($se),
|
||||
],
|
||||
]);
|
||||
|
||||
throw $se; // abort import so root cause surfaces
|
||||
}
|
||||
}
|
||||
|
||||
// Scope variables per row so they aren't reused after exception
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user