Commit 0b7c0367 by yeran

commit

1 parent f85b3e0c
Showing with 7 additions and 4 deletions
......@@ -15,6 +15,8 @@ use Phwoolcon\Exception\Http\CsrfException;
use Phwoolcon\Exception\Http\NotFoundException;
use Phwoolcon\Exception\HttpException;
defined('IS_DEBUG') or define('IS_DEBUG', false);
/**
* Class Router
*
......@@ -249,9 +251,10 @@ class Router extends PhalconRouter implements ServiceAwareInterface
//return static::$runningUnitTest ? $e : $e->toResponse();
} catch (\Exception $exception) {
$uuid = md5(uniqid(md5(microtime(true)), true));
$exceptionMessage = $exception->getMessage() . '---' . "['ERRORID:'{$uuid}]";
debug('[Exception] File:[' . $exception->getFile() . '] ' . 'Line:[' . $exception->getLine() . '] ' . 'Message:[' . $exceptionMessage . '] ', 'ERROR');
if (IS_DEBUG) {
$exceptionMessage = $exception->getMessage() . '---' . "['ERRORID:'{$uuid}]";
debug('[Exception] File:[' . $exception->getFile() . '] ' . 'Line:[' . $exception->getLine() . '] ' . 'Message:[' . $exceptionMessage . '] ', 'ERROR');
}
//捕获异常
$response = new Response(); //获取响应实例
//判断是否为API异常
......@@ -266,7 +269,7 @@ class Router extends PhalconRouter implements ServiceAwareInterface
}
$response->setContent($exception->getBody()); //设置响应内容
} else {
$errorMessage = "系统繁忙[ERRORID:{$uuid}]";
$errorMessage = IS_DEBUG ? "系统繁忙[ERRORID:{$uuid}]" : $exception->getMessage();
return self::exceptionResponse($response, $errorMessage);
}
return $response;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!