stefanzweifel / laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.
https://stefanzweifel.dev/posts/2023/06/15/introducing-laravel-backup-restore
MIT License
165 stars 15 forks source link

Restore backup without database dump throw error #84

Open scramatte opened 5 days ago

scramatte commented 5 days ago

Hi,

Restore backup without database dump throw error :

Wnx\LaravelBackupRestore\Exceptions\NoDatabaseDumpsFound 

      "No database dumps found in backup `app/only-files-2024-11-22-12-56-47.zip`."
    "Found files in db-dumps directory:"

  at vendor/wnx/laravel-backup-restore/src/Exceptions/NoDatabaseDumpsFound.php:17
     13▕     {
     14▕ 
     15▕         $files = $pendingRestore->getAvailableFilesInDbDumpsDirectory()->implode("\n");
     16▕ 
  ➜  17▕         return new static(<<<TXT
     18▕             "No database dumps found in backup `{$pendingRestore->backup}`."
     19▕             "Found files in db-dumps directory:"
     20▕             $files
     21▕         TXT

      +14 vendor frames 

  15  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()
stefanzweifel commented 4 days ago

This is intentional. As the exception name suggests, this is thrown if no database dumps can be found. I'm not sure what the best practice here is, but I personally like it, when I see all details when an error happens. We could obviously also catch the exception and return a non-successful status code and display the exception message in the terminal.