Created json_encode function which always maps to array and converts errors into exceptions

This commit is contained in:
Alejandro Celaya
2018-10-05 19:19:44 +02:00
parent e55dbef2fc
commit ff80f32f72
5 changed files with 28 additions and 16 deletions

View File

@@ -3,10 +3,12 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\Common\Exception;
use function sprintf;
class WrongIpException extends RuntimeException
{
public static function fromIpAddress($ipAddress, \Throwable $prev = null): self
{
return new self(\sprintf('Provided IP "%s" is invalid', $ipAddress), 0, $prev);
return new self(sprintf('Provided IP "%s" is invalid', $ipAddress), 0, $prev);
}
}