-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from wmde/master
Improve JsonPatch exceptions
Showing
9 changed files
with
344 additions
and
34 deletions.
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
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,5 @@ | ||
<?php | ||
|
||
namespace Swaggest\JsonDiff; | ||
|
||
class JsonPointerException extends Exception {} |
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,47 @@ | ||
<?php | ||
|
||
namespace Swaggest\JsonDiff; | ||
|
||
use Throwable; | ||
|
||
class MissingFieldException extends Exception | ||
{ | ||
/** @var string */ | ||
private $missingField; | ||
/** @var object */ | ||
private $operation; | ||
|
||
/** | ||
* @param string $missingField | ||
* @param object $operation | ||
* @param int $code | ||
* @param Throwable|null $previous | ||
*/ | ||
public function __construct( | ||
$missingField, | ||
$operation, | ||
$code = 0, | ||
Throwable $previous = null | ||
) | ||
{ | ||
parent::__construct('Missing "' . $missingField . '" in operation data', $code, $previous); | ||
$this->missingField = $missingField; | ||
$this->operation = $operation; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getMissingField() | ||
{ | ||
return $this->missingField; | ||
} | ||
|
||
/** | ||
* @return object | ||
*/ | ||
public function getOperation() | ||
{ | ||
return $this->operation; | ||
} | ||
} |
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,51 @@ | ||
<?php | ||
|
||
namespace Swaggest\JsonDiff; | ||
|
||
|
||
use Throwable; | ||
|
||
class PathException extends Exception | ||
{ | ||
/** @var object */ | ||
private $operation; | ||
|
||
/** @var string */ | ||
private $field; | ||
|
||
/** | ||
* @param string $message | ||
* @param object $operation | ||
* @param string $field | ||
* @param int $code | ||
* @param Throwable|null $previous | ||
*/ | ||
public function __construct( | ||
$message, | ||
$operation, | ||
$field, | ||
$code = 0, | ||
Throwable $previous = null | ||
) | ||
{ | ||
parent::__construct($message, $code, $previous); | ||
$this->operation = $operation; | ||
$this->field = $field; | ||
} | ||
|
||
/** | ||
* @return object | ||
*/ | ||
public function getOperation() | ||
{ | ||
return $this->operation; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getField() | ||
{ | ||
return $this->field; | ||
} | ||
} |
Oops, something went wrong.