Skip to content

Commit

Permalink
missing exception wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
jarischaefer committed Feb 23, 2017
1 parent feda37f commit b98c654
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Jarischaefer/HalApi/Exceptions/DatabaseConflictException.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace Jarischaefer\HalApi\Exceptions;

use Exception;
use RuntimeException;

/**
Expand All @@ -9,4 +10,13 @@
class DatabaseConflictException extends RuntimeException
{

/**
* @param string $message
* @param Exception|null $previous
*/
public function __construct(string $message = "", Exception $previous = null)
{
parent::__construct($message, 0, $previous);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function remove(Model $model)
try {
$deleted = $model->delete();
} catch (Exception $e) {
throw new DatabaseConflictException('Model could not be deleted: ' . $model->getKey());
throw new DatabaseConflictException('Model could not be deleted: ' . $model->getKey(), $e);
}

if (!$deleted) {
Expand Down

0 comments on commit b98c654

Please sign in to comment.