feat: improved error handling of xml parsers and loaders
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Exception;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
/**
|
||||
* Exception thrown when attempting to load travel data that does not exist.
|
||||
*
|
||||
* This exception is used when a travel/date ID cannot be found in the
|
||||
* available travel data sources (XML files or API).
|
||||
*/
|
||||
class TravelNotFoundException extends HttpException
|
||||
{
|
||||
public function __construct(int $dateId, ?\Throwable $previous = null)
|
||||
{
|
||||
$message = sprintf(
|
||||
'Travel data not found for date ID %d',
|
||||
$dateId
|
||||
);
|
||||
|
||||
parent::__construct(404, $message, $previous);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user