Clearly indicate exceptions that can be thrown in docs

Hi there, I recently had an issue that one of my client’s websites got broken because a remote request using Remote::get failed.

It turned out that an exception was thrown because the underlying cURL call failed, and I didn’t catch that exception in my code. However, I was not aware that an exception could be thrown here, since there was no mention of this in the docs (also not for Remote::request), and the code examples in the docs suggested using $response->code() === 200 as a way to check if the request succeeded.

I would suggest to indicate in the docs which Kirby methods can throw exceptions, including an indication of which exception (types) it could be, and in what situations they would be thrown. Also, it would be nice if this information was documented in the source code using @throws annotations, so my IDE could provide this information when using a Kirby method.

Exception are documented in the Reference when a @throws tag is present in the doc block, as for example for $page->copy() However, this is not always the case. So this would have to be added in the source code so it can be picked up by the documentation.

But yes, the examples could be improved…

Clear, thanks!

I’ve quickly created a PR adding the @throws tags to Remote, hope it’s helpful.