also looking at this
fix(ios): preserve busy errors through dispatch
#270
3 files
+33
-13
| @@ -418,18 +418,7 @@ fn hostServesItself(action: []const u8) bool { | ||
| 418 | 418 | /// settle. `NativeCallFailed` is the honest catch-all for "it broke in a way |
| 419 | 419 | /// the protocol has no word for". |
| 420 | 420 | fn 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); | |
| 433 | 422 | } |
| 434 | 423 | |
| 435 | 424 | /// 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" { | ||
| 790 | 779 | bridge_error.BridgeError.PlatformNotSupported, |
| 791 | 780 | asBridgeError(error.UnsupportedPlatform), |
| 792 | 781 | ); |
| 782 | try testing.expectEqual( | |
| 783 | bridge_error.BridgeError.Busy, | |
| 784 | asBridgeError(error.Busy), | |
| 785 | ); | |
| 793 | 786 | // The catch-all. An error the protocol has no word for still gets one. |
| 794 | 787 | try testing.expectEqual( |
| 795 | 788 | bridge_error.BridgeError.NativeCallFailed, |