samedi 24 septembre 2016

LaravelCollective SSH try catch exceptions fails

I need code for exceptions on connections. I use SSH of LaravelColletive on Laravel 5.3

When the exception belongs to ErrorException, such as that you can not connect to a port, if I work.

try {
   SSH::into('old')->get($full_old_file,$temp_file);
} catch (\ErrorException $e) {
   echo $e->getMessage();
}

if error it's incorrect port, show error and app continues.

Cannot connect to kvm401.setdart.com:22. Error 111. Connection refused

But if problem it's for example a use w wring ssh key, exception it's catched by RuntimeException and my try .. catch block not work, and app stop run.

[RuntimeException]                   
  Unable to connect to remote server. 

if possible try catch any type of exception?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire