[Pitch] A Swift representation for thrown-and-caught exceptions

Note that that isn't safe today. Exceptions cannot reliably pass through Swift frames, and on many platforms this will corrupt state and/or crash. If you need to catch an ObjC exception, the call to the throwing method must be done from ObjC. As part of C++ interop, we would implement a way to safely call a C++ or ObjC method that's expected to throw recoverable exceptions, and emit the necessary EH info around those calls to be able to bridge the exception over into a Swift error. What Jonathan is proposing here is the type that would be used to represent such exceptions, at least in the most general cases where there isn't a better bridging story available.

11 Likes