Skip to content

Commit 96419ad

Browse files
Nyholmsagikazarmark
authored andcommitted
Adding an interface that our exception implements (#67)
1 parent d3667df commit 96419ad

5 files changed

+22
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
### Added
77

88
- Added back `Http\Discovery\NotFoundException` to preserve BC with 0.8 version
9+
- Added interface `Http\Discovery\Exception` which is implemented by all our exceptions
910

1011
### Changed
1112

src/Exception.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Http\Discovery;
4+
5+
/**
6+
* An interface implemented by all discovery related exceptions.
7+
*
8+
* @author Tobias Nyholm <[email protected]>
9+
*/
10+
interface Exception
11+
{
12+
}

src/Exception/DiscoveryFailedException.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace Http\Discovery\Exception;
44

5+
use Http\Discovery\Exception;
6+
57
/**
68
* Thrown when all discovery strategies fails to find a resource.
79
*
810
* @author Tobias Nyholm <[email protected]>
911
*/
10-
final class DiscoveryFailedException extends \Exception
12+
final class DiscoveryFailedException extends \Exception implements Exception
1113
{
1214
/**
1315
* @var array

src/Exception/NotFoundException.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
namespace Http\Discovery\Exception;
44

5+
use Http\Discovery\Exception;
6+
57
/**
68
* Thrown when a discovery does not find any matches.
79
*
810
* @final do NOT extend this class, not final for BC reasons
911
*
1012
* @author Márk Sági-Kazár <[email protected]>
1113
*/
12-
/*final */class NotFoundException extends \RuntimeException
14+
/*final */class NotFoundException extends \RuntimeException implements Exception
1315
{
1416
}

src/Exception/StrategyUnavailableException.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace Http\Discovery\Exception;
44

5+
use Http\Discovery\Exception;
6+
57
/**
68
* This exception is thrown when we cannot use a discovery strategy. This is *not* thrown when
79
* the discovery fails to find a class.
810
*
911
* @author Tobias Nyholm <[email protected]>
1012
*/
11-
class StrategyUnavailableException extends \RuntimeException
13+
class StrategyUnavailableException extends \RuntimeException implements Exception
1214
{
1315
}

0 commit comments

Comments
 (0)