Nexmo / nexmo-laravel

Add Vonage functionality such as SMS and voice calling to your Laravel app with this Laravel Service Provider.
MIT License
318 stars 79 forks source link

How im supposed to catch exceptions? #8

Closed alejandrotrevi closed 7 years ago

alejandrotrevi commented 7 years ago

Im doing this:

    try {
            Nexmo::message()->send([
                'to' => $user->getPhoneWithCode(),
                'from' => '16105552344',
                'text' => 'CMM te saluda '. $user->name . ', tu numero de socio es: ' . $user->credential . ''
            ]);

        } catch (Exception $e) {
            Log::error('Nexmo error:' . $e->getMessage());
        }

but i still get the exception in the browser.

tjlytle commented 7 years ago

If that code is already in a namespace, you'll have to add a slash so it's \Exception.

alejandrotrevi commented 7 years ago

Oh, thank you soooo much!!