Skip to content

Commit 94fb7c7

Browse files
committed
Fix docs example
1 parent 33c6732 commit 94fb7c7

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/exception.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ pub fn throw_with_code(ex: &ClassEntry, code: i32, message: &str) -> Result<()>
179179
/// # Examples
180180
///
181181
/// ```no_run
182-
/// use ext_php_rs::{zend::{ce, ClassEntry}, exception::throw_with_code};
182+
/// use ext_php_rs::prelude::*;
183+
/// use ext_php_rs::exception::throw_object;
184+
/// use crate::ext_php_rs::convert::IntoZval;
183185
///
184186
/// #[php_class]
185187
/// #[extends(ext_php_rs::zend::ce::exception())]
@@ -191,8 +193,14 @@ pub fn throw_with_code(ex: &ClassEntry, code: i32, message: &str) -> Result<()>
191193
/// #[prop(flags = ext_php_rs::flags::PropertyFlags::Public)]
192194
/// file: String,
193195
/// }
194-
/// let error = JsException { message: "A JS error occurred.", code: 100, file: "index.js" };
195-
/// throw_object( error.into_val(true) );
196+
///
197+
/// #[php_module]
198+
/// pub fn get_module(module: ModuleBuilder) -> ModuleBuilder {
199+
/// module
200+
/// }
201+
///
202+
/// let error = JsException { message: "A JS error occurred.".to_string(), code: 100, file: "index.js".to_string() };
203+
/// throw_object( error.into_zval(true).unwrap() );
196204
/// ```
197205
pub fn throw_object(zval: Zval) -> Result<()> {
198206
unsafe {

0 commit comments

Comments
 (0)