diff --git a/bridges/FilterBridge.php b/bridges/FilterBridge.php index c6449114..696b100f 100644 --- a/bridges/FilterBridge.php +++ b/bridges/FilterBridge.php @@ -94,7 +94,7 @@ class FilterBridge extends FeedExpander { } try{ $this->collectExpandableDatas($this->getURI()); - } catch (HttpException $e) { + } catch (Exception $e) { $this->collectExpandableDatas($this->getURI()); } } diff --git a/bridges/WordPressBridge.php b/bridges/WordPressBridge.php index 2a750a95..1589c723 100644 --- a/bridges/WordPressBridge.php +++ b/bridges/WordPressBridge.php @@ -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'); } diff --git a/index.php b/index.php index 1b66ff5c..c093644a 100644 --- a/index.php +++ b/index.php @@ -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()); } diff --git a/lib/Exceptions.php b/lib/Exceptions.php index e9b4d7b8..4250f9f9 100644 --- a/lib/Exceptions.php +++ b/lib/Exceptions.php @@ -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 diff --git a/lib/error.php b/lib/error.php index 8546f6cd..9a0756f9 100644 --- a/lib/error.php +++ b/lib/error.php @@ -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); } /**