catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.84k stars 1.15k forks source link

[BUG] error() didn't display misconfigured error message #579

Closed daxiyun closed 7 years ago

daxiyun commented 7 years ago

Fatal error: Uncaught exception 'Exception' with message 'SQLSTATE[HY000] [1044] Access denied for user 'clipbrd'@'localhost' to database 'clipbrd0'' in /var/www/XXXXXXXXXXXXX/medoo_mysql.php:152 Stack trace: #0 /var/www/XXXXXXXXXXXXX/test.php(23): medoo->__construct(Array) #1 {main} thrown in /var/www/XXXXXXXXXXXXX/medoo_mysql.php on line 152

数据库名字、用户名、密码等配置错误 $conn->error() 无法捕获到错误信息,是500错误

catfan commented 7 years ago

This is not a bug.

error() is only for displaying error information associated with the last operation. It don't display misconfigured error message for initialization. You can try catch the new Medoo() error exception for more information.