sabre-io / dav

sabre/dav is a CalDAV, CardDAV and WebDAV framework for PHP
http://sabre.io
BSD 3-Clause "New" or "Revised" License
1.49k stars 342 forks source link

Error reporting to WebDAV clients #1119

Open dakhnod opened 5 years ago

dakhnod commented 5 years ago

Sometimes, i need to return a 501 status code in order to indicate, that a certain operation is not implemented. Is there any conventional way to return a message, which a WebDAV client should show besides simply "error"? Something that explains which feature exactly is blocked and thus causes a 501?

DeepDiver1975 commented 5 years ago

To report back a 501 you can throw a https://github.com/sabre-io/dav/blob/master/lib/DAV/Exception/NotImplemented.php

By default there is no message in exceptions/error responses defined within webdav ...

Still you can implement our own exception class with custom rendering of the response body like this https://github.com/sabre-io/dav/blob/09ed9f1dc417ccdca0f31dffdf9be565285cc2f0/lib/DAV/Exception/Locked.php#L58

Let me know if this is what you are searching for ....

dakhnod commented 5 years ago

Thanks for the response, i have managed to report a 501 one way or another.

What matters to me is the question whether there is a way to get WebDAV-compliant clients to display an arbitary string as a message.

The client i have worked with just showed an "error"-popup, not even displaying something like "not implemented". So, i wanted to find out if there is some way in the protocoll to get clients to show an arbitary string to the user.

DeepDiver1975 commented 5 years ago

So, i wanted to find out if there is some way in the protocoll to get clients to show an arbitary string to the user.

No. There is nothing related defined in the specifications: https://tools.ietf.org/html/rfc4918