We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I want to custom the exception use the bellow code, that's copy from https://davidcole1340.github.io/ext-php-rs/macros/classes.html#example
#![cfg_attr(windows, feature(abi_vectorcall))] extern crate ext_php_rs; use ext_php_rs::prelude::*; use ext_php_rs::{exception::PhpException, zend::ce}; #[php_class(name = "Redis\\Exception\\RedisException")] #[extends(ce::exception())] #[derive(Default)] pub struct RedisException; // Throw our newly created exception #[php_function] pub fn throw_exception() -> PhpResult<i32> { Err(PhpException::from_class::<RedisException>("Not good!".into())) } #[php_module] pub fn get_module(module: ModuleBuilder) -> ModuleBuilder { module }
tests/Unit/BasicTest.php
it('throw_exception', function () { throw_exception(); })->throws('Redis\Exception\RedisException', 'Not good!');
I get an error,
$ cargo build Compiling myproject-php v0.1.0 (myproject) Finished dev [unoptimized + debuginfo] target(s) in 1.19s $ php -d extension=../../target/debug/libmyproject_php.dylib vendor/bin/pest tests/Unit/BasicTest.php thread '<unnamed>' panicked at 'Attempted to access uninitialized class object', ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ext-php-rs-0.10.1/src/types/class_object.rs:245:14 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace fatal runtime error: failed to initiate panic, error 5 fish: Job 1, 'php -d extension=../../target/d…' terminated by signal SIGABRT (Abort)
Do you have any suggestions for me? I also want to create a PR to fix it, but I need some context or references first.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I want to custom the exception use the bellow code, that's copy from https://davidcole1340.github.io/ext-php-rs/macros/classes.html#example
tests/Unit/BasicTest.php
I get an error,
Do you have any suggestions for me? I also want to create a PR to fix it, but I need some context or references first.
The text was updated successfully, but these errors were encountered: