pub fn throw_with_code(ex: &ClassEntry, code: i32, message: &str) -> Result<()>Expand description
Throws an exception with a given message and status code. See ClassEntry
for some built-in exception types.
Returns a result containing nothing if the exception was successfully thrown.
§Parameters
- ex- The exception type to throw.
- code- The status code to use when throwing the exception.
- message- The message to display when throwing the exception.
§Errors
- Error::InvalidException- If the exception type is an interface or abstract class.
- If the message contains NUL bytes.
§Examples
use ext_php_rs::{zend::{ce, ClassEntry}, exception::throw_with_code};
throw_with_code(ce::compile_error(), 123, "This is a CompileError.");