ReviewOS

also looking at this

craft-native/craft

fix(ios): preserve busy errors through dispatch

#270
Merged glennmichael123 wants to merge codex/ios-busy-dispatch into main
3 files +33 -13
packages/zig/src/ios_dispatch.zigmodified+5-12
Changes to packages/zig/src/ios_dispatch.zig
@@ -418,18 +418,7 @@ fn hostServesItself(action: []const u8) bool {
418418/// settle. `NativeCallFailed` is the honest catch-all for "it broke in a way
419419/// the protocol has no word for".
420420fn asBridgeError(err: anyerror) bridge_error.BridgeError {
421 return switch (err) {
422 error.AllocationFailed, error.OutOfMemory => bridge_error.BridgeError.AllocationFailed,
423 error.InvalidJSON => bridge_error.BridgeError.InvalidJSON,
424 error.InvalidParameter => bridge_error.BridgeError.InvalidParameter,
425 error.MissingData => bridge_error.BridgeError.MissingData,
426 error.NotFound => bridge_error.BridgeError.NotFound,
427 error.PermissionDenied => bridge_error.BridgeError.PermissionDenied,
428 error.PlatformNotSupported, error.UnsupportedPlatform => bridge_error.BridgeError.PlatformNotSupported,
429 error.Timeout => bridge_error.BridgeError.Timeout,
430 error.UnknownAction => bridge_error.BridgeError.UnknownAction,
431 else => bridge_error.BridgeError.NativeCallFailed,
432 };
421 return bridge_error.fromHandlerError(err);
433422}
434423
435424/// Hand an action to the host shim. Returns false when there is no shim.
@@ -790,6 +779,10 @@ test "a handler error reaches the page as something the protocol can say" {
790779 bridge_error.BridgeError.PlatformNotSupported,
791780 asBridgeError(error.UnsupportedPlatform),
792781 );
782 try testing.expectEqual(
783 bridge_error.BridgeError.Busy,
784 asBridgeError(error.Busy),
785 );
793786 // The catch-all. An error the protocol has no word for still gets one.
794787 try testing.expectEqual(
795788 bridge_error.BridgeError.NativeCallFailed,