Refactor point value object and add observability
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Exception;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\WithHttpStatus;
|
||||
use function sprintf;
|
||||
|
||||
#[WithHttpStatus(Response::HTTP_UNPROCESSABLE_ENTITY, headers: ['x-error-code' => 'point_too_far'])]
|
||||
final class PointTooFarException extends \RuntimeException
|
||||
{
|
||||
public function __construct(float $maximumDistanceKm)
|
||||
{
|
||||
parent::__construct(sprintf('The submitted point must be within %.2fkm of your location.', $maximumDistanceKm));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user