Skip to content

Commit

Permalink
Do not record PDOException
Browse files Browse the repository at this point in the history
  • Loading branch information
tylercd100 committed Jul 3, 2018
1 parent 105c9d3 commit 8a68c73
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions src/Components/Recorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Recorder extends Component {
*/
protected $absolutelyDontHandle = [
\Tylercd100\LERN\Exceptions\RecorderFailedException::class,
\Doctrine\DBAL\Driver\PDOException::class,
];

/**
Expand Down Expand Up @@ -56,33 +57,28 @@ public function record(Exception $e)

$configDependant = array_keys($this->config['collect']);

try {
foreach ($configDependant as $key) {
if ($this->canCollect($key)) {
$value = $this->collect($key, $e);
if ($value !== null) {
$opts[$key] = $value;
}
foreach ($configDependant as $key) {
if ($this->canCollect($key)) {
$value = $this->collect($key, $e);
if ($value !== null) {
$opts[$key] = $value;
}
}
}

$class = config('lern.recorder.model');
$class = !empty($class) ? $class : ExceptionModel::class;
$class = config('lern.recorder.model');
$class = !empty($class) ? $class : ExceptionModel::class;

$model = new $class();
foreach($opts as $key => $value) {
$model->{$key} = $value;
}
$model = new $class();
foreach($opts as $key => $value) {
$model->{$key} = $value;
}

$model->save();
$model->save();

Cache::forever($this->getCacheKey($e), Carbon::now());
Cache::forever($this->getCacheKey($e), Carbon::now());

return $model;
} catch (Exception $e) {
$code = (is_int($e->getCode()) ? $e->getCode() : 0);
throw new RecorderFailedException($e->getMessage(), $code, $e);
}
return $model;
}

/**
Expand Down

0 comments on commit 8a68c73

Please sign in to comment.