laravel 5 - Hadle cartlyst strip plan error -


i creating payment plan strip using cartalyst strip api in laravel application, working correctly when strip shows error, directly showing in dom. want store in variable , redirect previous page. have used try...catch method not working create plan.

below code

$stripe = stripe::make(stripe_key); try {     $plan = $stripe->plans()->create([               'id'                    => 'monthly',               'name'                  => 'palan name'               'amount'                => '22',               'currency'              => 'usd',               'interval'              => 'month',               'interval_count'        => '6',               'statement_descriptor'  => 'test description'             ]); } catch (stripe\error\base $e) {      echo($e->getmessage()); } 

i'm not familiar library think issue not catching errors here cartalyst has in own namespace. can see in documentation give examples on how catch errors:

try {     $customer = $stripe->customers()->find('foobar');      echo $customer['email']; } catch (cartalyst\stripe\exception\notfoundexception $e) {     // status code     $code = $e->getcode();      // error message returned stripe     $message = $e->getmessage();      // error type returned stripe     $type = $e->geterrortype(); } 

they don't mention how catch base 1 though , don't have access code double check i'd guess it's oversight , can catch cartalyst\stripe\exception\base $e


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -