[cxx-interop] Errors/Exceptions crash the Swift runtime instead of being forwarded to C++ #75290
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
c++ interop
Feature: Interoperability with C++
Description
I'm bridging Swift classes to C++ to use them from C++.
One of my classes has a function that throws an error, but I haven't found a way to implement error throwing in Swift yet (other than through Optional results).
I tried multiple approaches:
Swift errors
^ the problem with this approach is that
throwError()
is no longer accessible from C++ once it hasthrows
in it's method signature.Obj-C errors
^ the problem with this approach is that the exception cannot be propagated to C++, it will always be "unhandled"
C++ errors
^ the problem with this approach is the same as with Obj-C errors - they are not propagated to C++ and will always be "unhandled". I cannot wrap them in a
try
/catch
in C++.Reproduction
Expected behavior
I expect errors/exceptions to be propagated upwards to C++ so I can handle them from there.
Environment
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
Additional information
No response
The text was updated successfully, but these errors were encountered: