diff --git a/app/Console/Commands/Emails.php b/app/Console/Commands/Emails.php index a022d54dc..43ba06804 100644 --- a/app/Console/Commands/Emails.php +++ b/app/Console/Commands/Emails.php @@ -167,7 +167,7 @@ public function handle() ]); } $output = 'Because of an error, the backup of the database '.$db->name.' failed.'; - $this->mail = (new BackupFailed($backup, $db, $output))->toMail(); + $this->mail = (new BackupFailed($backup, $db, $output, $backup->database_name ?? 'unknown'))->toMail(); $this->sendEmail(); break; case 'backup-success': diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.php index b28bce7cf..5bf98c4c8 100644 --- a/app/Jobs/DatabaseBackupJob.php +++ b/app/Jobs/DatabaseBackupJob.php @@ -705,7 +705,9 @@ public function failed(?Throwable $exception): void // Notify team about permanent failure if ($this->team) { - $this->team->notify(new BackupFailed($this->backup, $this->database, $this->backup_output)); + $databaseName = $log?->database_name ?? 'unknown'; + $output = $this->backup_output ?? $exception?->getMessage() ?? 'Unknown error'; + $this->team->notify(new BackupFailed($this->backup, $this->database, $output, $databaseName)); } } }