#[non_exhaustive]pub enum Error {
Show 30 variants
IncorrectArguments(usize, usize),
ZvalConversion(DataType),
UnknownFunctionType(u8),
InvalidTypeToDatatype(ZvalTypeFlags),
InvalidScope,
InvalidPointer,
DuplicateProperty {
property: String,
},
DuplicateMethod {
method: String,
},
DuplicateConstant {
constant: String,
},
DuplicateFunction {
function: String,
},
DuplicateClass {
class: String,
},
InvalidProperty {
property: String,
},
InvalidEnumCase {
case: String,
},
InvalidCString {
position: usize,
},
InvalidUtf8,
Callable,
Object,
NotStringable(String),
InvalidException(ClassFlags),
IntegerOverflow,
Catch(CatchError),
ExceptionPending {
class: String,
},
StreamWrapperRegistrationFailure,
StreamWrapperUnregistrationFailure,
SapiWriteUnavailable,
OutputHandlerStartFailed,
ResponseHeaderFailed,
SapiActivateUnderDl,
LazyObjectFailed,
AutoGlobalLoadFailed(&'static str),
}Expand description
The main error type which is passed by the library inside the custom
Result type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
IncorrectArguments(usize, usize)
An incorrect number of arguments was given to a PHP function.
The enum carries two integers - the first representing the number of arguments that were received, and the second representing the minimum number of arguments expected.
ZvalConversion(DataType)
There was an error converting a Zval into a primitive type.
The enum carries the data type of the Zval.
UnknownFunctionType(u8)
The function type read from the engine is not one this crate models.
The enum carries the raw value read from zend_function.type.
InvalidTypeToDatatype(ZvalTypeFlags)
Attempted to convert a ZvalTypeFlags struct to a DataType.
The flags did not contain a datatype.
The enum carries the flags that were attempted to be converted to a
DataType.
InvalidScope
The function called was called in an invalid scope (calling class-related functions inside of a non-class bound function).
InvalidPointer
The pointer inside a given type was invalid, either null or pointing to garbage.
DuplicateProperty
A class declared two properties with the same name, for example a
#[php(prop)] field and a #[php(getter)] method.
DuplicateMethod
A class or enum declared two methods whose names differ only by ASCII case. PHP method names ignore case.
DuplicateConstant
A class declared two constants, or an enum two cases, with the same name.
DuplicateFunction
A module declared two functions whose names differ only by ASCII case.
DuplicateClass
A class, interface or enum with this name, ignoring ASCII case, is already registered with the engine.
InvalidProperty
The given property name does not exist.
InvalidEnumCase
The enum has no case matching the given name or discriminant.
InvalidCString
The string could not be converted into a C-string due to the presence of a NUL character.
InvalidUtf8
The string could not be converted into a valid Utf8 string
Callable
Could not call the given function.
Object
An object was expected.
NotStringable(String)
The object’s class does not implement __toString(), so it cannot be
converted into a string.
The enum carries the name of the class.
InvalidException(ClassFlags)
An invalid exception type was thrown.
IntegerOverflow
Converting integer arguments resulted in an overflow.
Catch(CatchError)
The engine did not run a try_catch closure to completion.
ExceptionPending
A PHP exception is pending in the executor globals.
The exception is left where the engine put it, so it propagates on its
own once control returns to PHP. Take ownership of it with
ExecutorGlobals::take_exception to handle it from Rust.
The enum carries the class name of the pending exception.
StreamWrapperRegistrationFailure
A failure occurred while registering the stream wrapper
StreamWrapperUnregistrationFailure
A failure occurred while unregistering the stream wrapper
The SAPI write function is not available
OutputHandlerStartFailed
The engine refused to start an output handler: no request is active, or a registered conflict check rejected the handler name.
ResponseHeaderFailed
The engine refused to change the response headers: no request is
active, a SapiGlobals guard is alive, or the header is invalid or
comes after the headers were sent.
SapiActivateUnderDl
A module loaded with dl() has a sapi_activate_function. PHP unloads
such a module at the end of the request, while the SAPI keeps the hook.
LazyObjectFailed
Failed to make an object lazy (PHP 8.4+)
AutoGlobalLoadFailed(&'static str)
The engine failed to load an auto-global.
The enum carries the name of the auto-global.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()