fix(seeder): handle exceptions in VillageSeeder

- Menambahkan penanganan kesalahan saat menjalankan seeder untuk menghindari kegagalan tanpa informasi.
- Menggunakan Log untuk mencatat kesalahan yang terjadi saat memuat data dari file villages.sql.
This commit is contained in:
Daeng Deni Mardaeni
2025-01-15 09:40:26 +07:00
parent 6f899fa131
commit 0b58db9d16
2 changed files with 83475 additions and 83470 deletions

View File

@@ -4,6 +4,7 @@ namespace Modules\Location\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class VillageSeeder extends Seeder
{
@@ -12,8 +13,12 @@ class VillageSeeder extends Seeder
*/
public function run(): void
{
DB::unprepared(file_get_contents(__DIR__ . '/villages.sql'));
try {
DB::unprepared(file_get_contents(__DIR__ . '/villages.sql'));
} catch (\Exception $e) {
Log::error('Seeder Error: ' . $e->getMessage());
throw $e;
}
}
}

File diff suppressed because it is too large Load Diff