Skip to content

Commit 33f9d6e

Browse files
committed
Improvement
1 parent ab55a49 commit 33f9d6e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/zend/fibers.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ impl EventLoop {
5050
let (notify_receiver, notify_sender) =
5151
sys_pipe().map_err(|err| format!("Could not create pipe: {}", err))?;
5252

53-
call_user_func!(Function::try_from_function("class_exists").unwrap(), "\\Revolt\\EventLoop").unwrap();
54-
call_user_func!(Function::try_from_function("interface_exists").unwrap(), "\\Revolt\\EventLoop\\Suspension").unwrap();
53+
call_user_func!(Function::try_from_function("class_exists").unwrap(), "\\Revolt\\EventLoop")?;
54+
call_user_func!(Function::try_from_function("interface_exists").unwrap(), "\\Revolt\\EventLoop\\Suspension")?;
5555

5656
Ok(Self {
5757
fibers: ZendHashTable::new(),
@@ -60,9 +60,9 @@ impl EventLoop {
6060
notify_sender: unsafe { File::from_raw_fd(notify_sender) },
6161
notify_receiver: unsafe { File::from_raw_fd(notify_receiver) },
6262
dummy: [0; 1],
63-
get_current_suspension: Function::try_from_method("\\Revolt\\EventLoop", "getSuspension").unwrap(),
64-
suspend: Function::try_from_method("\\Revolt\\EventLoop\\Suspension", "suspend").unwrap(),
65-
resume: Function::try_from_method("\\Revolt\\EventLoop\\Suspension", "resume").unwrap()
63+
get_current_suspension: Function::try_from_method("\\Revolt\\EventLoop", "getSuspension").ok_or("\\Revolt\\EventLoop::getSuspension does not exist")?,
64+
suspend: Function::try_from_method("\\Revolt\\EventLoop\\Suspension", "suspend").ok_or("\\Revolt\\Suspension::suspend does not exist")?,
65+
resume: Function::try_from_method("\\Revolt\\EventLoop\\Suspension", "resume").ok_or("\\Revolt\\Suspension::resume does not exist")?
6666
})
6767
}
6868

0 commit comments

Comments
 (0)