-
Notifications
You must be signed in to change notification settings - Fork 0
/
HttpException.php
34 lines (30 loc) · 1022 Bytes
/
HttpException.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/*
* This file is part of the OpenStates Framework (osf) package.
* (c) Guillaume Ponçon <[email protected]>
* For the full copyright and license information, please read the LICENSE file distributed with the project.
*/
namespace Osf\Exception;
/**
* Exception with HTTP code
*
* @author Guillaume Ponçon <[email protected]>
* @copyright OpenStates
* @version 1.0
* @since OSF-2.0 - 14 sept. 2013
* @package osf
* @subpackage exception
*/
class HttpException extends OsfException
{
protected $managedCodes = array(404, 301);
public function __construct($message = null, $code = null, $previous = null)
{
if (!in_array($code, $this->managedCodes)) {
$httpCodes = implode(', ', $this->managedCodes);
$msg = sprintf('HttpException launched without known http code. Choose one of theses: %s', $httpCodes);
throw new ArchException($msg);
}
parent::__construct($message, $code, $previous);
}
}