Skip to content

Commit

Permalink
Merge pull request barryvdh#575 from jared-is-ray/error-handling
Browse files Browse the repository at this point in the history
add error handing in "clear" command to ignore exceptions about storage locations that do exist
  • Loading branch information
barryvdh authored Dec 16, 2016
2 parents e2cf4f4 + ac59f68 commit 52b6bee
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Console/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ public function __construct(DebugBar $debugbar)
public function fire()
{
$this->debugbar->boot();

if ($storage = $this->debugbar->getStorage()) {
$storage->clear();
try
{
$storage->clear();
} catch(\InvalidArgumentException $e) {
// hide InvalidArgumentException if storage location does not exist
if(strpos($e->getMessage(), 'does not exist') === false) {
throw $e;
}
}
$this->info('Debugbar Storage cleared!');
} else {
$this->error('No Debugbar Storage found..');
Expand Down

0 comments on commit 52b6bee

Please sign in to comment.