File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ class Response
3636
3737 private $ response = '' ;
3838
39+ private $ error = [];
40+
3941 /**
4042 * Default API response constructor
4143 * - optionally set response.
@@ -81,6 +83,10 @@ public function getRawResponse () {
8183 return $ this ->response ;
8284 }
8385
86+ public function getRawError () {
87+ return $ this ->error ;
88+ }
89+
8490 /**
8591 * Set API response
8692 * - decode from JSON.
@@ -91,6 +97,7 @@ public function getRawResponse () {
9197 */
9298 public function set ($ data )
9399 {
100+ $ this ->error = [];
94101 $ result = null ;
95102 switch ($ this ->format ) {
96103 case 'nvp ' :
@@ -103,7 +110,10 @@ public function set($data)
103110 $ this ->data = empty ($ data ) ? [] : (json_decode ($ data , true ) ?: []);
104111 $ result = json_last_error () == JSON_ERROR_NONE ;
105112 if (empty ($ result )) {
106- throw new RuntimeException ("Error decoding: " . json_last_error_msg ());
113+ $ this ->error = [
114+ 'error ' => json_last_error (),
115+ 'msg ' => json_last_error_msg (),
116+ ];
107117 }
108118 break ;
109119 }
You can’t perform that action at this time.
0 commit comments