diff options
author | zotlabs <mike@macgirvin.com> | 2017-12-05 18:20:38 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-12-05 18:20:38 -0800 |
commit | b7ca2b41cc35490d595e549f8b99c3991d27cb04 (patch) | |
tree | 925bc0d429f8cba79864091d90b64d1c3d1b6939 | |
parent | 8451ee20c913a76dd301375823bbda7364f18310 (diff) | |
download | volse-hubzilla-b7ca2b41cc35490d595e549f8b99c3991d27cb04.tar.gz volse-hubzilla-b7ca2b41cc35490d595e549f8b99c3991d27cb04.tar.bz2 volse-hubzilla-b7ca2b41cc35490d595e549f8b99c3991d27cb04.zip |
mod_cloud: provide a themed page with an error notification on errors instead of an obtuse XML error structure
-rw-r--r-- | Zotlabs/Module/Cloud.php | 24 | ||||
-rw-r--r-- | Zotlabs/Storage/Browser.php | 2 |
2 files changed, 25 insertions, 1 deletions
diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php index 0f7f9c47a..2215507ca 100644 --- a/Zotlabs/Module/Cloud.php +++ b/Zotlabs/Module/Cloud.php @@ -87,6 +87,10 @@ class Cloud extends \Zotlabs\Web\Controller { // $server->addPlugin(new \Zotlabs\Storage\\QuotaPlugin($auth)); + // over-ride the default XML output on thrown exceptions + + $server->on('exception', [ $this, 'DAVException' ]); + // All we need to do now, is to fire up the server $server->exec(); @@ -97,4 +101,24 @@ class Cloud extends \Zotlabs\Web\Controller { killme(); } + + function DAVException($err) { + + if($err instanceof \Sabre\DAV\Exception\NotFound) { + notice( t('Not found') . EOL); + } + elseif($err instanceof \Sabre\DAV\Exception\Forbidden) { + notice( t('Permission denied') . EOL); + } + else { + notice( t('Unknown error') . EOL); + } + + construct_page(); + + killme(); + } + } + + diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php index 26abf27b5..c21b68971 100644 --- a/Zotlabs/Storage/Browser.php +++ b/Zotlabs/Storage/Browser.php @@ -12,7 +12,7 @@ use Sabre\DAV; * * @extends \\Sabre\\DAV\\Browser\\Plugin * - * @link http://github.com/friendica/red + * @link http://github.com/redmatrix/hubzilla * @license http://opensource.org/licenses/mit-license.php The MIT License (MIT) */ class Browser extends DAV\Browser\Plugin { |