catfan / Medoo

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

Handling exception #583

Closed lamuzzachiodi closed 3 years ago

lamuzzachiodi commented 7 years ago

I'm a newbie user so maybe i can't see something but testing my db connection i've forced an error and i've got an exception. That's good but not "to degrade gracefully". In my humble opinion would be intuitive and less intrusive return a value in the info function for example or maybe in an specific function for check the state connection or something like that.

adarshmadrecha commented 6 years ago

I have also encountered the same issue.

    $database = new Medoo([
      'database_type' => 'mysql',
      'database_name' => $databasename,
      'server'        => $host,
      'username'      => $username,
      'password'      => $password,
    ]);

Now if the password is incorrect, I expected the $database->error() to handle the error and give me a message. But instead, I get a Fatal error. It would be really helpful if all the errors are handled by error() method.