Skip to content

Commit

Permalink
add exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared King committed Dec 29, 2015
1 parent f103fb1 commit f33efc9
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/Exception/DriverException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Pulsar\Exception;

use Exception;

class DriverException
{
/**
* @var Exception
*/
private $exception;

/**
* Sets the underlying exception.
*
* @param Exception $e
*/
public function setException(Exception $e)
{
$this->exception = $e;
}

/**
* Gets the underlying exception.
*
* @return Exception
*/
public function getException()
{
return $this->exception;
}
}
17 changes: 17 additions & 0 deletions src/Exception/NotFoundException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

/**
* @author Jared King <j@jaredtking.com>
*
* @link http://jaredtking.com
*
* @copyright 2015 Jared King
* @license MIT
*/
namespace Pulsar\Exception;

use Exception;

class NotFoundException extends Exception
{
}
14 changes: 14 additions & 0 deletions tests/Exception/DriverExceptionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

use Pulsar\Exception\DriverException;

class DriverExceptionTest extends PHPUnit_Framework_TestCase
{
public function testException()
{
$e = new Exception();
$ex = new DriverException();
$ex->setException($e);
$this->assertEquals($e, $ex->getException());
}
}

0 comments on commit f33efc9

Please sign in to comment.