mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
错误编码
This commit is contained in:
@@ -71,7 +71,7 @@ class App
|
||||
// 执行操作
|
||||
if (!preg_match('/^[A-Za-z](\/|\.|\w)*$/', CONTROLLER_NAME)) {
|
||||
// 安全检测
|
||||
throw new Exception('class [ ' . MODULE_NAME . '\\' . CONTROLLER_LAYER . '\\' . Loader::parseName(str_replace('.', '\\', CONTROLLER_NAME), 1) . ' ] not exists');
|
||||
throw new Exception('illegal controller name:' . CONTROLLER_NAME, 10000);
|
||||
}
|
||||
if ($config['action_bind_class']) {
|
||||
$class = self::bindActionClass($config['empty_controller']);
|
||||
@@ -85,7 +85,7 @@ class App
|
||||
}
|
||||
|
||||
if (!$instance) {
|
||||
throw new Exception('class [ ' . MODULE_NAME . '\\' . CONTROLLER_LAYER . '\\' . Loader::parseName(str_replace('.', '\\', CONTROLLER_NAME), 1) . ' ] not exists');
|
||||
throw new Exception('class [ ' . MODULE_NAME . '\\' . CONTROLLER_LAYER . '\\' . Loader::parseName(str_replace('.', '\\', CONTROLLER_NAME), 1) . ' ] not exists', 10001);
|
||||
}
|
||||
try {
|
||||
// 操作方法开始监听
|
||||
@@ -122,7 +122,7 @@ class App
|
||||
$method = new \ReflectionMethod($instance, '_empty');
|
||||
$method->invokeArgs($instance, [$action, '']);
|
||||
} else {
|
||||
throw new Exception('method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists ');
|
||||
throw new Exception('method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists ', 10002);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ class App
|
||||
// 空操作
|
||||
$class = $namespace . '_empty';
|
||||
} else {
|
||||
throw new Exception('_ERROR_ACTION_:' . ACTION_NAME);
|
||||
throw new Exception('bind action class not exists :' . ACTION_NAME, 10003);
|
||||
}
|
||||
return $class;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ class App
|
||||
} elseif ($param->isDefaultValueAvailable()) {
|
||||
$args[] = $param->getDefaultValue();
|
||||
} else {
|
||||
throw new Exception('_PARAM_ERROR_:' . $name);
|
||||
throw new Exception('url param bind error:' . $name, 10004);
|
||||
}
|
||||
}
|
||||
return $args;
|
||||
@@ -325,7 +325,7 @@ class App
|
||||
// 初始化模块
|
||||
self::initModule(MODULE_NAME, $config);
|
||||
} else {
|
||||
throw new Exception('module [ ' . MODULE_NAME . ' ] not exists ');
|
||||
throw new Exception('module [ ' . MODULE_NAME . ' ] not exists ', 10005);
|
||||
}
|
||||
|
||||
// 获取控制器名
|
||||
|
||||
@@ -21,7 +21,7 @@ class Create
|
||||
return;
|
||||
} else {
|
||||
if (!touch($lockfile)) {
|
||||
throw new Exception('应用目录[' . APP_PATH . ']不可写,目录无法自动生成!<BR>请手动生成项目目录~');
|
||||
throw new Exception('应用目录[' . APP_PATH . ']不可写,目录无法自动生成!<BR>请手动生成项目目录~', 10006);
|
||||
}
|
||||
}
|
||||
foreach ($build as $module => $list) {
|
||||
|
||||
@@ -256,7 +256,7 @@ class Loader
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new Exception('_CLASS_NOT_EXIST_:' . $class);
|
||||
throw new Exception('class not exist :' . $class, 10007);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -969,7 +969,7 @@ class Model
|
||||
} elseif (is_string($data)) {
|
||||
parse_str($data, $data);
|
||||
} elseif (!is_array($data)) {
|
||||
throw new Exception(Lang::get('_DATA_TYPE_INVALID_'));
|
||||
throw new Exception('data type invalid', 10300);
|
||||
}
|
||||
$this->data = $data;
|
||||
return $this;
|
||||
@@ -1099,7 +1099,7 @@ class Model
|
||||
$options = $union;
|
||||
}
|
||||
} else {
|
||||
throw new Exception(Lang::get('_DATA_TYPE_INVALID_'));
|
||||
throw new Exception('data type invalid', 10300);
|
||||
}
|
||||
$this->options['union'][] = $options;
|
||||
return $this;
|
||||
|
||||
@@ -71,7 +71,9 @@ class Session
|
||||
// 读取session驱动
|
||||
$class = '\\think\\session\\driver\\' . strtolower($config['type']);
|
||||
// 检查驱动类
|
||||
session_set_save_handler(new $class());
|
||||
if (!session_set_save_handler(new $class())) {
|
||||
throw new Exception('error session handler', 11700);
|
||||
}
|
||||
}
|
||||
// 启动session
|
||||
if (!empty($config['auto_start'])) {
|
||||
|
||||
@@ -301,7 +301,7 @@ class Template
|
||||
}
|
||||
// PHP语法检查
|
||||
if ($this->config['tpl_deny_php'] && false !== strpos($content, '<?php')) {
|
||||
throw new Exception('_NOT_ALLOW_PHP_');
|
||||
throw new Exception('not allow php tag', 11600);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
@@ -388,7 +388,7 @@ class Template
|
||||
$xml = '<tpl><tag ' . $attrs . ' /></tpl>';
|
||||
$xml = simplexml_load_string($xml);
|
||||
if (!$xml) {
|
||||
throw new Exception('_XML_TAG_ERROR_');
|
||||
throw new Exception('template tag define error', 11601);
|
||||
}
|
||||
$xml = (array) ($xml->tag->attributes());
|
||||
$array = array_change_key_case($xml['@attributes']);
|
||||
@@ -658,10 +658,10 @@ class Template
|
||||
//模板函数过滤
|
||||
$fun = strtolower(trim($args[0]));
|
||||
switch ($fun) {
|
||||
case 'default': // 特殊模板函数
|
||||
case 'default': // 特殊模板函数
|
||||
$name = '(' . $name . ')?(' . $name . '):' . $args[1];
|
||||
break;
|
||||
default: // 通用模板函数
|
||||
default: // 通用模板函数
|
||||
if (!in_array($fun, $template_deny_funs)) {
|
||||
if (isset($args[1])) {
|
||||
if (strstr($args[1], '###')) {
|
||||
|
||||
@@ -133,7 +133,7 @@ class View
|
||||
$template = $this->parseTemplate($template);
|
||||
// 模板不存在 抛出异常
|
||||
if (!is_file($template)) {
|
||||
throw new Exception('template file not exists:' . $template);
|
||||
throw new Exception('template file not exists:' . $template, 10700);
|
||||
}
|
||||
}
|
||||
$vars = $vars ? $vars : $this->data;
|
||||
|
||||
@@ -22,7 +22,7 @@ h2{ padding-bottom:.3em;line-height:1.225;border-bottom:1px solid #eee;color: #0
|
||||
<body>
|
||||
<div class="error">
|
||||
<p class="face">:(</p>
|
||||
<h1><?php echo strip_tags($e['message']);?></h1>
|
||||
<h1><?php echo '<span style="color:#999">[ '.$e['code'].' ]</span> '.strip_tags($e['message']);?></h1>
|
||||
<div class="content">
|
||||
<?php if(isset($e['file'])) {?>
|
||||
<div class="info">
|
||||
|
||||
Reference in New Issue
Block a user