Module objc2::exception

source ·
Expand description

§@throw and @try/@catch exceptions.

By default, if the msg_send! macro causes an exception to be thrown, this will unwind into Rust, resulting in undefined behavior. However, this crate has an "catch-all" feature which, when enabled, wraps each msg_send! in a @catch and panics if an exception is caught, preventing Objective-C from unwinding into Rust.

Most of the functionality in this module is only available when the "exception" feature is enabled.

See the following links for more information:

Structs§

Functions§

  • catchexception
    Tries to execute the given closure and catches an Objective-C exception if one is thrown.
  • throwexception
    Throws an Objective-C exception.