Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to catch exception RuntimeException on SSH? #34

Open
abkrim opened this issue Oct 23, 2016 · 1 comment
Open

How to catch exception RuntimeException on SSH? #34

abkrim opened this issue Oct 23, 2016 · 1 comment

Comments

@abkrim
Copy link

abkrim commented Oct 23, 2016

Hi.

For some errors such incorrect permission of key, wrong credentials, SSH package put a "RuntimeException"

I test with try .. catch but not work. Programan stop.
I need continue write log and send email.

try {
            SSH::run(['hostname -f']);  // for test purposes
 } catch (RuntimeException $e) {
            echo "Error".PHP_EOL;
 }
// DO something also if SSH fails

Apreciate help

@stidges
Copy link

stidges commented Aug 31, 2017

You could try catching any kind of exception to see if that gets your better results:

try {
    SSH::run(['hostname -f']);
} catch (\Exception $e) {
    //
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants