31 if (preg_match(
'/^([A-Z]+)([0-9]+)$/', $code, $reg)) {
32 $class = sprintf(
"ErrorCode%s", $reg[1]);
34 $rc =
new ReflectionClass(
$class);
35 $fmt = $rc->getConstant($code);
38 $nargs = func_num_args();
40 for ($ip = 1; $ip < $nargs; $ip++) {
41 $sp[] = func_get_arg($ip);
43 $label = @vsprintf($fmt, $sp);
45 $msg = sprintf(
"{%s} %s", $code, $label);
47 $gl = error_get_last();
48 $msg = sprintf(
"{%s} %s", $code, $gl[
'message']);
51 $msg = sprintf(
"unknow error code %s", $code);
55 $msg = sprintf(
"cannot find class error for %s : %s (%s)", $code, $e->getMessage() , implode(
', ', func_get_args()));
58 $msg = sprintf(
"wrong error code %s", $code);
if(substr($wsh, 0, 1)!= '/') $args
static getError($code, $args=null)
static method use to retrieve error code