Error Handling

This commit is contained in:
devansh bawari 2021-02-05 15:02:34 +05:30
parent 4d8a6cf0ed
commit 5bb09dbe9f
1 changed files with 11 additions and 3 deletions

View File

@ -58,7 +58,11 @@ class SmartButtonController extends Controller
*/
public function createOrder()
{
return response()->json($this->smartButton->createOrder($this->buildRequestBody()));
try {
return response()->json($this->smartButton->createOrder($this->buildRequestBody()));
} catch (\Exception $e) {
throw $e;
}
}
/**
@ -68,8 +72,12 @@ class SmartButtonController extends Controller
*/
public function captureOrder()
{
$this->smartButton->captureOrder(request()->input('orderData.orderID'));
return $this->saveOrder();
try {
$this->smartButton->captureOrder(request()->input('orderData.orderID'));
return $this->saveOrder();
} catch (\Exception $e) {
throw $e;
}
}
/**