samedi 22 octobre 2016

Laravel not running try catch block

Ive run into a little issue.

Im calling a method using the following

$this->testConnection($request->all());

The method looks like so

private function testConnection($data)
{
    try {
        $conn = ftp_connect($data['host']);
        if (false === $conn) {
            throw new Exception('Cant connect');
        }

    } catch (\Exception $e) {
        return redirect()->route('create')->withInput()->withErrors($e->getMessage());
    }
}

It doesnt seem to be running the try catch block though ... If i add

dd($data);

Inside the try section, nothing happens, yet if i put it above the try line, it works fine.

Im using Laravel 5.3

Any help would be grand.

Cheers,



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire