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 to make Nexmo to throw errors in Json #13

Closed eddywm closed 7 years ago

eddywm commented 7 years ago

I am trying to find a way of using Nexmo in a Laravel setup to throw errors in json so that they can be easily handled by my rest client but with no success so far.

mheap commented 7 years ago

Hi @eddywm,

nexmo/laravel isn't concerned with output formats, only with returning data/errors. To return JSON errors, you need to catch the exception thrown by Nexmo and return json($e->getMessage());