3 namespace Shaarli\Api\Exceptions
;
6 * Class ApiAuthorizationException
8 * Request not authorized, return a 401 HTTP code.
10 class ApiAuthorizationException
extends ApiException
15 public function getApiResponse()
17 $this->setMessage('Not authorized');
18 return $this->buildApiResponse(401);
22 * Set the exception message.
24 * We only return a generic error message in production mode to avoid giving
25 * to much security information.
27 * @param $message string the exception message.
29 public function setMessage($message)
31 $original = $this->debug
=== true ? ': '. $this->getMessage() : '';
32 $this->message
= $message . $original;