Macro ext_php_rs::throw [−][src]
macro_rules! throw {
($ex : expr, $reason : expr) => { ... };
}
Expand description
Throws an exception and returns from the current function.
Wraps the throw
function by inserting a return
statement after throwing the exception.
Examples
use ext_php_rs::{throw, php::{class::ClassEntry, execution_data::ExecutionData, types::zval::Zval}};
pub extern "C" fn example_fn(execute_data: &mut ExecutionData, _: &mut Zval) {
let something_wrong = true;
if something_wrong {
throw!(ClassEntry::exception(), "Something is wrong!");
}
assert!(false); // This will not run.
}