exception: Remove HttpException class

This class served no particular purpose (other than adding a
layer on top of Exception).
This commit is contained in:
logmanoriginal 2018-11-18 16:53:21 +01:00
parent dbffbd4d4e
commit c6a7b9ac64
5 changed files with 6 additions and 16 deletions

View File

@ -94,7 +94,7 @@ class FilterBridge extends FeedExpander {
}
try{
$this->collectExpandableDatas($this->getURI());
} catch (HttpException $e) {
} catch (Exception $e) {
$this->collectExpandableDatas($this->getURI());
}
}

View File

@ -93,7 +93,7 @@ class WordPressBridge extends FeedExpander {
}
try{
$this->collectExpandableDatas($this->getURI() . '/feed/atom/');
} catch (HttpException $e) {
} catch (Exception $e) {
$this->collectExpandableDatas($this->getURI() . '/?feed=atom');
}

View File

@ -109,7 +109,7 @@ try {
// whitelist control
if(!Bridge::isWhitelisted($bridge)) {
throw new \HttpException('This bridge is not whitelisted', 401);
throw new \Exception('This bridge is not whitelisted', 401);
die;
}
@ -272,11 +272,8 @@ try {
} else {
echo BridgeList::create($showInactive);
}
} catch(HttpException $e) {
} catch(\Exception $e) {
error_log($e);
header('Content-Type: text/plain', true, $e->getCode());
die($e->getMessage());
} catch(\Exception $e) {
error_log($e);
die($e->getMessage());
}

View File

@ -11,13 +11,6 @@
* @link https://github.com/rss-bridge/rss-bridge
*/
/**
* Implements a RSS-Bridge specific exception class
*
* @todo This class serves no purpose, remove it!
*/
class HttpException extends \Exception{}
/**
* Returns an URL that automatically populates a new issue on GitHub based
* on the information provided

View File

@ -14,14 +14,14 @@
/**
* Throws an exception when called.
*
* @throws \HttpException when called
* @throws \Exception when called
* @param string $message The error message
* @param int $code The HTTP error code
* @link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes List of HTTP
* status codes
*/
function returnError($message, $code){
throw new \HttpException($message, $code);
throw new \Exception($message, $code);
}
/**