X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FHTTPException.php;h=d6698605d0a08dc1a57d4cba28fd378a30ab13fa;hb=2a431b580f2e8f6a596e84175932e793678cde63;hp=eec4a9ced244ddc9a50b121eceaf2285d650f806;hpb=b41bf77ec8187b6c7bdc5229510032662901e416;p=friendica.git diff --git a/src/Network/HTTPException.php b/src/Network/HTTPException.php index eec4a9ced2..d6698605d0 100644 --- a/src/Network/HTTPException.php +++ b/src/Network/HTTPException.php @@ -1,23 +1,45 @@ -httpdesc == "") { - $this->httpdesc = preg_replace("|([a-z])([A-Z])|",'$1 $2', str_replace("Exception","",get_class($this))); - } - parent::__construct($message, $code, $previous); - } -} +. + * + */ + +namespace Friendica\Network; + +use Exception; + +/** + * Throwable exceptions to return HTTP status code + * + * This list of Exception has been extracted from + * here http://racksburg.com/choosing-an-http-status-code/ + */ +abstract class HTTPException extends Exception +{ + public $httpdesc = ''; + + public function __construct($message = '', Exception $previous = null) + { + parent::__construct($message, $this->code, $previous); + + if (empty($this->httpdesc)) { + $classname = str_replace('Exception', '', str_replace('Friendica\Network\HTTPException\\', '', get_class($this))); + $this->httpdesc = preg_replace("|([a-z])([A-Z])|",'$1 $2', $classname); + } + } +}