Skip to content
New issue

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

Custom exceptions #7

Open
veewee opened this issue Apr 15, 2023 · 0 comments
Open

Custom exceptions #7

veewee opened this issue Apr 15, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@veewee
Copy link
Owner

veewee commented Apr 15, 2023

Currently this repo throws a default PHP \Exception.
It should be better if we at-least provided a Wasm\Exception

Other possible exceptions:

Do note that currently we'll need to work around these limitations:

static mut WASM_EXCEPTION: Option<&'static ClassEntry> = None;

#[php_startup]
pub fn startup() {
    let ce_wasm_exception = ClassBuilder::new("Wasm\\Exception\\Exception")
        .extends(ce::exception())
        .build()
        .expect("Invalid check");
    unsafe { WASM_EXCEPTION.replace(ce_wasm_exception) };
}

//--> Return
PhpException::new(e.to_string(), 0, unsafe {
    WASM_EXCEPTION.expect("did not set exception ce")
})
@veewee veewee added enhancement New feature or request help wanted Extra attention is needed labels Apr 15, 2023
@veewee veewee moved this to Todo in Ext-wasm MVP Apr 15, 2023
@veewee veewee added this to the 0.1.0 milestone Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: Todo
Development

No branches or pull requests

1 participant