ably-labs / ably-chat-swift

Ably Chat SDK for Swift to build chat experiences at scale
Apache License 2.0
0 stars 1 forks source link

Revisit the errors thrown by library #32

Open lawrence-forooghian opened 2 months ago

lawrence-forooghian commented 2 months ago

I’m currently just throwing ably-cocoa’s ARTErrorInfo type, with custom error domain and new set of error codes. This is what the JS SDK does. The spec at time of writing also makes mention of errors with numeric codes. If we decide to stick with this approach, then we should expose some API in ably-cocoa to allow creating an ARTErrorInfo with a custom domain and cause, to replace the copied-and-pasted code in init(errorCode:).

We also need to make sure that numeric error codes and status codes are consistent across platforms (the spec doesn't specify the error code or status code for all errors at time of writing).

We might also decide that we wish to not use ARTErrorInfo and instead create something more appropriate to Swift (i.e. that doesn't inherit from NSError).

Update: #45 has introduced other, non-ARTErrorInfo errors such as PaginatedResultError and MessagesError. Need to figure out what to do with those, too. It’s also throwing errors in the ably-cocoa error domain, which we need to revisit.

┆Issue is synchronized with this Jira Task by Unito