X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FHTTPException.php;h=b6be886b35f25bf396110610cb16c776251f8fa8;hb=88c95a352b70621dc54b5b95cea6c3d319818f40;hp=7602290c2b873c3a7e8eddea441260e8b7feed4c;hpb=5a0f33dca061ef544d5985fd019c681db63a5534;p=friendica.git diff --git a/src/Network/HTTPException.php b/src/Network/HTTPException.php index 7602290c2b..b6be886b35 100644 --- a/src/Network/HTTPException.php +++ b/src/Network/HTTPException.php @@ -1,27 +1,45 @@ -httpdesc == '') { - $classname = str_replace('Exception', '', str_replace('Friendica\Network\HTTPException\\', '', get_class($this))); - $this->httpdesc = preg_replace("|([a-z])([A-Z])|",'$1 $2', $classname); - } - 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); + } + } +}