Follow-up from #779 by @ayaangazali -- thanks again for that PR!
What
After #779, Electron's two native error paths report different categories for the same code range. native/proto_bridge.cpp's ProtoError carries the sdkError that rac_result_to_proto_error in core/src/foundation/rac_proto_adapters.cpp:1036-1039 built, which still only maps |100|-|329| and falls through to INTERNAL. native/addon.cpp's make_rac_error (16 call sites, e.g. :932, :3785) attaches no category at all, so those errors fall to the shared categoryForCode at bindings/electron/src/errors.ts:329, which now maps 330-699 to real categories. So code 600 (BACKEND_NOT_FOUND) is COMPONENT on one native path and INTERNAL on the other. Web has the same split depending on whether a WASM module is loaded. The other SDKs disagree too: bindings/python/runanywhere/errors.py:10-17 and bindings/kotlin/.../CppBridgeRAG.kt:254-263 each carry their own copy of the range table, and none of the three matches the TS convenience table's 18 ranges.
Why it matters
An app catching error.category can get a different answer depending on which native code path threw inside one SDK, and a different answer again across Kotlin, Python and Electron/Web/RN for the same underlying rac_result_t. The TS table's own header comment names commons' narrow mapping a known, deliberately deferred gap -- this issue is that deferred work.
Suggested approach
- Widen commons
rac_result_to_proto_category (core/src/foundation/rac_proto_adapters.cpp) to the same 18-range mapping bindings/proto-ts/src/convenience/errors_category.ts already documents as canonical.
- Once commons matches, remove the Python and Kotlin-RAG copies so every SDK defers to one table again.
- Optionally, have
addon.cpp's make_rac_error attach sdkError the way proto_bridge.cpp's ProtoError does, so Electron's own two native paths stop disagreeing even before commons is widened.
Done when
Not blocking #779. @ayaangazali, you know this code well now -- you're welcome to take this one if you're interested.
Opened with help from Claude Code and Codex.
Reviewed with help from Claude Code and Codex.
Follow-up from #779 by @ayaangazali -- thanks again for that PR!
What
After #779, Electron's two native error paths report different categories for the same code range.
native/proto_bridge.cpp'sProtoErrorcarries thesdkErrorthatrac_result_to_proto_errorincore/src/foundation/rac_proto_adapters.cpp:1036-1039built, which still only maps |100|-|329| and falls through toINTERNAL.native/addon.cpp'smake_rac_error(16 call sites, e.g.:932,:3785) attaches no category at all, so those errors fall to the sharedcategoryForCodeatbindings/electron/src/errors.ts:329, which now maps 330-699 to real categories. So code 600 (BACKEND_NOT_FOUND) isCOMPONENTon one native path andINTERNALon the other. Web has the same split depending on whether a WASM module is loaded. The other SDKs disagree too:bindings/python/runanywhere/errors.py:10-17andbindings/kotlin/.../CppBridgeRAG.kt:254-263each carry their own copy of the range table, and none of the three matches the TS convenience table's 18 ranges.Why it matters
An app catching
error.categorycan get a different answer depending on which native code path threw inside one SDK, and a different answer again across Kotlin, Python and Electron/Web/RN for the same underlyingrac_result_t. The TS table's own header comment names commons' narrow mapping a known, deliberately deferred gap -- this issue is that deferred work.Suggested approach
rac_result_to_proto_category(core/src/foundation/rac_proto_adapters.cpp) to the same 18-range mappingbindings/proto-ts/src/convenience/errors_category.tsalready documents as canonical.addon.cpp'smake_rac_errorattachsdkErrorthe wayproto_bridge.cpp'sProtoErrordoes, so Electron's own two native paths stop disagreeing even before commons is widened.Done when
idl/errors.protocode.rac_result_tproduces the sameErrorCategoryon every SDK, and on every native error path within a given SDK.Not blocking #779. @ayaangazali, you know this code well now -- you're welcome to take this one if you're interested.
Opened with help from Claude Code and Codex.
Reviewed with help from Claude Code and Codex.