diff --git a/library/think/app.php b/library/think/app.php
index 4cebdedb..a303c78c 100644
--- a/library/think/app.php
+++ b/library/think/app.php
@@ -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);
}
// 获取控制器名
diff --git a/library/think/create.php b/library/think/create.php
index 81f1fcca..bc9e2c8d 100644
--- a/library/think/create.php
+++ b/library/think/create.php
@@ -21,7 +21,7 @@ class Create
return;
} else {
if (!touch($lockfile)) {
- throw new Exception('应用目录[' . APP_PATH . ']不可写,目录无法自动生成!
请手动生成项目目录~');
+ throw new Exception('应用目录[' . APP_PATH . ']不可写,目录无法自动生成!
请手动生成项目目录~', 10006);
}
}
foreach ($build as $module => $list) {
diff --git a/library/think/loader.php b/library/think/loader.php
index d8739b37..e2239681 100644
--- a/library/think/loader.php
+++ b/library/think/loader.php
@@ -256,7 +256,7 @@ class Loader
}
} else {
- throw new Exception('_CLASS_NOT_EXIST_:' . $class);
+ throw new Exception('class not exist :' . $class, 10007);
}
}
diff --git a/library/think/model.php b/library/think/model.php
index 30f7d993..62154311 100644
--- a/library/think/model.php
+++ b/library/think/model.php
@@ -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;
diff --git a/library/think/session.php b/library/think/session.php
index b3f69cb6..70f6c1ba 100644
--- a/library/think/session.php
+++ b/library/think/session.php
@@ -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'])) {
diff --git a/library/think/template.php b/library/think/template.php
index 3f7669fb..7a5afa64 100644
--- a/library/think/template.php
+++ b/library/think/template.php
@@ -301,7 +301,7 @@ class Template
}
// PHP语法检查
if ($this->config['tpl_deny_php'] && false !== strpos($content, '
:(
- +