ReviewOS

also looking at this

craft-native/craft

fix(ios): report async pool exhaustion as busy

#267
Merged glennmichael123 wants to merge codex/ios-busy-error-code into main
19 files +53 -65
packages/zig/src/bridge_error.zigmodified+5-0
Changes to packages/zig/src/bridge_error.zig
@@ -18,6 +18,8 @@ pub const BridgeError = error{
1818 InvalidJSON,
1919 /// Invalid parameter value
2020 InvalidParameter,
21 /// Native work is temporarily at capacity or an exclusive resource is in use
22 Busy,
2123 /// Platform not supported for this operation
2224 PlatformNotSupported,
2325 /// Native API call failed
@@ -152,6 +154,7 @@ pub fn errorCodeString(err: BridgeError) []const u8 {
152154 BridgeError.MissingData => "MISSING_DATA",
153155 BridgeError.InvalidJSON => "INVALID_JSON",
154156 BridgeError.InvalidParameter => "INVALID_PARAMETER",
157 BridgeError.Busy => "BUSY",
155158 BridgeError.PlatformNotSupported => "PLATFORM_NOT_SUPPORTED",
156159 BridgeError.NativeCallFailed => "NATIVE_CALL_FAILED",
157160 BridgeError.AllocationFailed => "ALLOCATION_FAILED",
@@ -174,6 +177,7 @@ pub fn errorMessage(err: BridgeError) []const u8 {
174177 BridgeError.MissingData => "Required data is missing",
175178 BridgeError.InvalidJSON => "Failed to parse JSON data",
176179 BridgeError.InvalidParameter => "Invalid parameter value",
180 BridgeError.Busy => "Native operation is temporarily busy",
177181 BridgeError.PlatformNotSupported => "This operation is not supported on the current platform",
178182 BridgeError.NativeCallFailed => "Native API call failed",
179183 BridgeError.AllocationFailed => "Memory allocation failed",
@@ -351,6 +355,7 @@ test "errorCodeString returns correct codes" {
351355 try testing.expectEqualStrings("WINDOW_HANDLE_NOT_SET", errorCodeString(BridgeError.WindowHandleNotSet));
352356 try testing.expectEqualStrings("UNKNOWN_ACTION", errorCodeString(BridgeError.UnknownAction));
353357 try testing.expectEqualStrings("MISSING_DATA", errorCodeString(BridgeError.MissingData));
358 try testing.expectEqualStrings("BUSY", errorCodeString(BridgeError.Busy));
354359}
355360
356361test "ErrorContext.toJSON produces valid JSON" {