Skip to content

Commit

Permalink
error handling at artisan down
Browse files Browse the repository at this point in the history
  • Loading branch information
match committed Jun 8, 2019
1 parent 31eee29 commit 6563c2e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Illuminate/Foundation/Console/DownCommand.php
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Foundation\Console;

use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\InteractsWithTime;

Expand Down Expand Up @@ -32,12 +33,17 @@ class DownCommand extends Command
*/
public function handle()
{
file_put_contents(
storage_path('framework/down'),
json_encode($this->getDownFilePayload(), JSON_PRETTY_PRINT)
);
try {
file_put_contents(storage_path('framework/down'),
json_encode($this->getDownFilePayload(),
JSON_PRETTY_PRINT));
$this->comment('Application is now in maintenance mode.');
} catch (Exception $e) {
$this->error('Application is failed to enter maintenance mode.');
$this->error($e->getMessage());

$this->comment('Application is now in maintenance mode.');
return false;
}
}

/**
Expand Down

0 comments on commit 6563c2e

Please sign in to comment.