From b7ca2b41cc35490d595e549f8b99c3991d27cb04 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 5 Dec 2017 18:20:38 -0800 Subject: mod_cloud: provide a themed page with an error notification on errors instead of an obtuse XML error structure --- Zotlabs/Module/Cloud.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Zotlabs/Module') 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(); + } + } + + -- cgit v1.2.3