Debugging Import: Multiple types of exceptions occurred

Sometimes when working with Filament imports, I'll see this popup in the log:
Multiple types of exceptions occurred: [TypeError], [Illuminate\Database\QueryException]
Multiple types of exceptions occurred: [TypeError], [Illuminate\Database\QueryException]
This exception isn't super helpful and it doesn't give context into the query or what happened. it's the only thing in the log -- doesn't provide the query statement or anything like that. Any ideas how to debug this?
1 Reply
undercode
undercode2mo ago
Hi! In my case, I had to modify handleException function in \Filament\Actions\Imports\Jobs\ImportCsv.php with this:
protected function handleExceptions(array $exceptions): void
{
if (empty($exceptions)) {
return;
}

if (count($exceptions) > 1) {
$exception_description = '';
foreach ($exceptions as $exception) {
$exception_description = '[' . $exception::class . ": \n\t" . $exception->getMessage() . "]\n\n";
}
throw new Exception('Multiple types of exceptions occurred: ' . $exception_description);
//throw new Exception('Multiple types of exceptions occurred: [' . implode('], [', array_keys($exceptions)) . ']');
}

throw Arr::first($exceptions);
}
protected function handleExceptions(array $exceptions): void
{
if (empty($exceptions)) {
return;
}

if (count($exceptions) > 1) {
$exception_description = '';
foreach ($exceptions as $exception) {
$exception_description = '[' . $exception::class . ": \n\t" . $exception->getMessage() . "]\n\n";
}
throw new Exception('Multiple types of exceptions occurred: ' . $exception_description);
//throw new Exception('Multiple types of exceptions occurred: [' . implode('], [', array_keys($exceptions)) . ']');
}

throw Arr::first($exceptions);
}