Php Laravel Remote错误未由try catch处理

时间:2017-05-28 19:15:55

标签: php try-catch remote-access

所以我有这个代码,当我由于某种原因无法连接(错误的凭据或没有网络连接或类似的东西)时,我正试图捕获错误,但它无法正常工作,我的应用程序因错误而崩溃。

try {
    $connection = new Remote([
        'host' => $equipment->ip_address,
        'port' => 22,
        'username' => EquipmentAccess::where('equipment_id', $equipment->id)->first()->ssh_user,
        'password' => EquipmentAccess::where('equipment_id', $equipment->id)->first()->ssh_password,
    ]);
    $command = $request->command . ' ' . $request->argv;
    $ip = $connection->exec($command);
} catch (Exception $e) {
    echo "Houston, we have a problem:" . $e;
}

如果有人能给我任何关于我错过的信息,我们将非常感激。

编辑:我想,我还不够清楚。它与典型的laravel管道错误崩溃,最新的是它无法连接到该设备。它应该只是给我我的错误信息。

EDIT2:这是指向堆栈跟踪的SS的链接 - https://gyazo.com/9095d5600be2b7f07ca59d93624f9187

0 个答案:

没有答案