2022-02-05 03:21:59 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Exceptions;
|
|
|
|
|
|
|
|
class BidNotFound extends AbstractHttpException
|
|
|
|
{
|
|
|
|
private $bid_id;
|
|
|
|
|
|
|
|
public function __construct($bid_id)
|
|
|
|
{
|
|
|
|
$this->bid_id = $bid_id;
|
|
|
|
parent::__construct(
|
|
|
|
404,
|
|
|
|
'The bid '.$bid_id.' was not found'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the RFC 7807 error type (without the URL root)
|
|
|
|
*/
|
|
|
|
public function getErrorType(): string
|
|
|
|
{
|
|
|
|
return 'bid-not-found';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the detailed error string
|
|
|
|
*/
|
|
|
|
public function getErrorDetails(): string
|
|
|
|
{
|
|
|
|
return $this->getMessage();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an array with the error details, merged with the RFC7807 response
|
|
|
|
*/
|
|
|
|
public function getErrorMetadata(): array
|
|
|
|
{
|
|
|
|
return [
|
2022-02-09 00:12:39 +08:00
|
|
|
'bid_id' => $this->bid_id,
|
2022-02-05 03:21:59 +08:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|