summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-22 22:00:51 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-22 22:00:51 +0200
commit441d70e1889abec4fbe390258b9cc0a847e0c70c (patch)
tree2af35dc438568381de50f26cd3f9c75edeb80898
parent813f24b942c19560ff3964e73541ab4fba0567d8 (diff)
set error handler and throw exceptions on error case
-rw-r--r--CHANGELOG.md3
-rw-r--r--appinfo/application.php8
-rw-r--r--fetcher/feedfetcher.php9
3 files changed, 15 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 852ea98a9..ac299d00a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+owncloud-news (3.103)
+* **Bugfix**: Turn all errors into exceptions to prevent failing of all feeds if one feed runs into an error
+
owncloud-news (3.102)
* **Bugfix**: Fix z-index for stable7 so menu buttons dont overlap content in mobile view
* **Bugfix**: Use public namespace for template script and style template functions
diff --git a/appinfo/application.php b/appinfo/application.php
index 2dea28fc2..4c99583e6 100644
--- a/appinfo/application.php
+++ b/appinfo/application.php
@@ -67,6 +67,14 @@ class Application extends App {
public function __construct(array $urlParams=array()){
parent::__construct('news', $urlParams);
+ // Turn all errors into exceptions to combat shitty library behavior
+ set_error_handler(function ($code, $message) {
+ if ($code === E_ERROR || $code === E_USER_ERROR) {
+ throw new \Exception($message, $code);
+ }
+ });
+
+
$container = $this->getContainer();
diff --git a/fetcher/feedfetcher.php b/fetcher/feedfetcher.php
index 0e4dc7a4b..63c33c0ae 100644
--- a/fetcher/feedfetcher.php
+++ b/fetcher/feedfetcher.php
@@ -89,12 +89,11 @@ class FeedFetcher implements IFeedFetcher {
$simplePie->set_proxyuserpwd($this->proxyAuth);
}
- if (!$simplePie->init()) {
- throw new FetcherException('Could not initialize simple pie on feed with url ' . $url);
- }
-
-
try {
+ if (!$simplePie->init()) {
+ throw new \Exception('Could not initialize simple pie on feed with url ' . $url);
+ }
+
// somehow $simplePie turns into a feed after init
$items = [];
$permaLink = $simplePie->get_permalink();