pocketbase / js-sdk

PocketBase JavaScript SDK
https://www.npmjs.com/package/pocketbase
MIT License
2.06k stars 122 forks source link

Better reporting of code errors, JSDoc throws annotation #262

Closed pepa-linha closed 8 months ago

pepa-linha commented 9 months ago

Hi, according to the documentation

https://github.com/pocketbase/js-sdk?tab=readme-ov-file#error-handling

in fact, every method on the collection can throw a ClientResponseError error, which is fine, but I would expect such information in the code to catch such errors.

I would therefore expect an annotation for such methods

@throws {ClientResponseError}

What do you think?

(For example, such an error can occur if I do not have a server with Pocketbase running. In short, all calls must be wrapped in a try-catch.)

ganigeorgiev commented 8 months ago

Note that every Promise can throw, but I'll document the exception with the next minor release sometime later today.