-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2af9cfb
commit a2f6e51
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace AmpProject\Exception; | ||
|
||
use RuntimeException; | ||
|
||
/** | ||
* Exception thrown when a link could not be created. | ||
* | ||
* @package ampproject/amp-toolbox | ||
*/ | ||
final class FailedToCreateLink extends RuntimeException implements AmpException | ||
{ | ||
|
||
/** | ||
* Instantiate a FailedToCreateLink exception for a link that could not be created. | ||
* | ||
* @param mixed $link Link that was not as expected. | ||
* @return self | ||
*/ | ||
public static function forLink($link) | ||
{ | ||
$type = is_object($link) ? get_class($link) : gettype($link); | ||
$message = "Failed to create a link via the link manager. " | ||
. "Expected to produce an 'AmpProject\\Dom\\Element', got '$type' instead."; | ||
|
||
return new self($message); | ||
} | ||
} |