You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TODO as a separate piece of work we should stop using ARTErrorInfo in
the mock channel; that should have been stopped a long time ago!
TODO look at the changes it's made to test helpers
TODO use the same `toErrorInfo` helper as in LiveObjects
after giving it feedback
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,15 +46,14 @@ To check formatting and code quality, run `swift run BuildTool lint`. Run with `
46
46
### Throwing errors
47
47
48
48
- The public API of the SDK should use typed throws, and the thrown errors should be of type `ErrorInfo`.
49
-
- Currently, we throw the `InternalError` type everywhere internally, and then convert it to `ErrorInfo` at the public API.
50
49
51
50
If you haven't worked with typed throws before, be aware of a few sharp edges:
52
51
53
52
- Some of the Swift standard library does not (yet?) interact as nicely with typed throws as you might hope.
54
53
- It is not currently possible to create a `Task`, `CheckedContinuation`, or `AsyncThrowingStream` with a specific error type. You will need to instead return a `Result` and then call its `.get()` method.
55
54
-`Dictionary.mapValues` does not support typed throws. We have our own extension `ablyChat_mapValuesWithTypedThrow` which does; use this.
56
-
- There are times when the compiler struggles to infer the type of the error thrown within a `do` block. In these cases, you can disable type inference for a `do` block and explicitly specify the type of the thrown error, like: `do throws(InternalError) { … }`.
57
-
- The compiler will never infer the type of the error thrown by a closure; you will need to specify this yourself; e.g. `let items = try jsonValues.map { jsonValue throws(InternalError) in … }`.
55
+
- There are times when the compiler struggles to infer the type of the error thrown within a `do` block. In these cases, you can disable type inference for a `do` block and explicitly specify the type of the thrown error, like: `do throws(ErrorInfo) { … }`.
56
+
- The compiler will never infer the type of the error thrown by a closure; you will need to specify this yourself; e.g. `let items = try jsonValues.map { jsonValue throws(ErrorInfo) in … }`.
serial =try jsonObject.stringValueForKey("serial")
58
58
}
59
59
}
60
60
61
61
// (CHA-M3) Messages are sent to Ably via the Chat REST API, using the send method.
62
62
// (CHA-M3a) When a message is sent successfully, the caller shall receive a struct representing the Message in response (as if it were received via Realtime event).
0 commit comments