Skip to content

Commit

Permalink
Fix throwing exceptions from remote calendars.
Browse files Browse the repository at this point in the history
If the server didn't respond with a 200 code, we used an incorrect exception, so it wasn't properly catched where necessary. We used an untranslated, not very helpful message too. Use a translatable error message an include the remote URL instead.
  • Loading branch information
yunosh committed Jan 18, 2017
1 parent 7ac599b commit c7e4c52
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions kronolith/lib/Driver/Ical.php
Expand Up @@ -636,10 +636,11 @@ public function getRemoteCalendar($cache = true)
}
}

$error = sprintf(_("Could not open %s"), $url);
try {
$response = $this->_getClient($url)->request('GET');
if ($response['statusCode'] != 200) {
throw new Horde_Dav_Exception('Request Failed', $response['statusCode']);
throw new Kronolith_Exception($error, $response['statusCode']);
}
} catch (\Sabre\HTTP\ClientException $e) {
throw new Kronolith_Exception($e);
Expand All @@ -649,10 +650,7 @@ public function getRemoteCalendar($cache = true)
$url, $e->getHttpStatus()),
'INFO'
);
$error = sprintf(
_("Could not open %s: %s"),
$url, $e->getResponse()->getStatusText()
);
$error .= ': ' . $e->getResponse()->getStatusText();
if ($cache) {
$cacheOb->set($signature, serialize($error));
}
Expand Down

0 comments on commit c7e4c52

Please sign in to comment.