File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -94,8 +94,17 @@ public function query()
94
94
95
95
$ raw = (string ) $ response ->getBody ();
96
96
97
- return new ResultSet ($ raw );
97
+ return $ this ->asResultSet ($ raw );
98
+ }
98
99
100
+ /**
101
+ * @param $raw
102
+ * @return ResultSet
103
+ * @throws \InfluxDB\Client\Exception
104
+ */
105
+ protected function asResultSet ($ raw )
106
+ {
107
+ return new ResultSet ($ raw );
99
108
}
100
109
101
110
/**
Original file line number Diff line number Diff line change @@ -30,12 +30,20 @@ class ResultSet
30
30
public function __construct ($ raw )
31
31
{
32
32
$ this ->rawResults = $ raw ;
33
- $ this ->parsedResults = json_decode ((string ) $ raw , true );
33
+ $ this ->parsedResults = json_decode ((string )$ raw , true );
34
34
35
35
if (json_last_error () !== JSON_ERROR_NONE ) {
36
36
throw new \InvalidArgumentException ('Invalid JSON ' );
37
37
}
38
38
39
+ $ this ->validate ();
40
+ }
41
+
42
+ /**
43
+ * @throws ClientException
44
+ */
45
+ protected function validate ()
46
+ {
39
47
// There was an error in the query thrown by influxdb
40
48
if (isset ($ this ->parsedResults ['error ' ])) {
41
49
throw new ClientException ($ this ->parsedResults ['error ' ]);
You can’t perform that action at this time.
0 commit comments