File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 5
5
6
6
namespace Omnipay \PayPal \Message ;
7
7
8
+ use Omnipay \Common \Exception \InvalidResponseException ;
9
+
8
10
/**
9
11
* PayPal Abstract REST Request
10
12
*
@@ -160,9 +162,15 @@ function ($event) {
160
162
// logging engine is being used.
161
163
// echo "Data == " . json_encode($data) . "\n";
162
164
163
- $ httpResponse = $ httpRequest ->send ();
164
-
165
- return $ this ->response = $ this ->createResponse ($ httpResponse ->json (), $ httpResponse ->getStatusCode ());
165
+ try {
166
+ $ httpResponse = $ httpRequest ->send ();
167
+ return $ this ->response = $ this ->createResponse ($ httpResponse ->json (), $ httpResponse ->getStatusCode ());
168
+ } catch (\Exception $ e ) {
169
+ throw new InvalidResponseException (
170
+ 'Error communicating with payment gateway: ' . $ e ->getMessage (),
171
+ $ e ->getCode ()
172
+ );
173
+ }
166
174
}
167
175
168
176
/**
You can’t perform that action at this time.
0 commit comments