Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze authored and github-actions[bot] committed Aug 30, 2023
1 parent 6fd549b commit 08eba5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Commands/BackupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public function handle(): int
report($exception);

if (! $disableNotifications) {
event($exception instanceof BackupFailed
event(
$exception instanceof BackupFailed
? new BackupHasFailed($exception->getPrevious(), $exception->backupDestination)
: new BackupHasFailed($exception)
);
Expand Down
6 changes: 4 additions & 2 deletions src/Exceptions/BackupFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ class BackupFailed extends Exception
{
public ?BackupDestination $backupDestination = null;

public static function from(Exception $exception): static {
public static function from(Exception $exception): static
{
return new static($exception->getMessage(), $exception->getCode(), $exception);
}

public function destination(BackupDestination $backupDestination): static {
public function destination(BackupDestination $backupDestination): static
{
$this->backupDestination = $backupDestination;

return $this;
Expand Down
1 change: 0 additions & 1 deletion tests/Notifications/EventHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use Illuminate\Support\Facades\Notification;
use Spatie\Backup\BackupDestination\BackupDestinationFactory;
use Spatie\Backup\Events\BackupHasFailed;
use Spatie\Backup\Exceptions\BackupFailed;
use Spatie\Backup\Notifications\Notifiable;
use Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification as BackupHasFailedNotification;

Expand Down

0 comments on commit 08eba5b

Please sign in to comment.