LLMS_Generator::get_error_code( int $code, obj $class )
Retrieve a human-readable error code from a machine-readable error number
Parameters Parameters
- $code
-
(int) (Required) Error number.
- $class
-
(obj) (Required) Generator class instance.
Return Return
(string) A human-readable error code.
Source Source
File: includes/class.llms.generator.php
protected function get_error_code( $code, $class ) { // See if the error code is a native php exception code constant. $ret = llms_php_error_constant_to_code( $code ); // Code is not a native PHP exception code. if ( is_numeric( $ret ) ) { $reflect = new ReflectionClass( $class ); $constants = array_flip( $reflect->getConstants() ); $ret = isset( $constants[ $code ] ) ? $constants[ $code ] : 'ERROR_UNKNOWN'; } /** * Filter the human-readable error retrieved from a given error code * * @since 4.9.0 * * @param string $ret The human-readable error code. * @param int $code The initial error code as an integer. * @param obj $class Generator class instance. */ return apply_filters( 'llms_generator_get_error_code', $ret, $code, $class ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.9.0 | Handle PHP core errors, warnings, notices, etc... with a human-readable error code. |
4.7.0 | Introduced. |