mod_cloud: provide a themed page with an error notification on errors instead of an obtuse XML error structure
This commit is contained in:
parent
8451ee20c9
commit
b7ca2b41cc
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user