Leonidas-from-XIV / slacko

A neat interface for Slack
https://leonidas-from-xiv.github.io/slacko
Other
81 stars 11 forks source link

Exception Slacko.No_matches is not exposed in the API but may be raised #8

Closed Khady closed 8 years ago

Khady commented 8 years ago

The function users_info may raise an exception No_matches if the user given as a parameter does not exist. As this exception is not exposed, it is not possible to catch it and apply a specific behaviour for it.

Am I missing something in the API?

Leonidas-from-XIV commented 8 years ago

In general I would like to avoid exceptions to propagate to client code, that's why there is the `User_not_found variant which should be returned instead.

It looks like I forgot to add the code that handles this failure altogether, I probably need to read https://ocsigen.org/lwt/dev/api/Lwt#2_Exceptionshandling and figure out how best to apply that in Slacko.

Khady commented 8 years ago

Ok. I also prefer to deal with the variant rather than with the exception. I suspect that the exception can also be raised when using a channel or group name. Same for Lookup_failed and No_unique_matches.

Leonidas-from-XIV commented 8 years ago

Can you give the isolate-lwt-exceptions branch a try? I reworked it so that it should catch the Lwt exceptions inside the code.

Khady commented 8 years ago

It works for me. No more exceptions. Thanks!