Skip to content

Commit a798bbd

Browse files
authored
Fix IP2Location test (#1149)
* Update IP2Location.php * Add missing cached response
1 parent 79d9fbb commit a798bbd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Provider/IP2Location/IP2Location.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ private function executeQuery(string $url): AddressCollection
110110
}
111111

112112
if (isset($data['response'])) {
113-
if (preg_match('/suspended|denied|invalid account/i', $data['response'])) {
113+
if (preg_match('/suspended|denied|invalid/i', $data['response'])) {
114114
throw new InvalidCredentials('API Key provided is not valid.');
115115
} elseif (preg_match('/insufficient/i', $data['response'])) {
116116
throw new InvalidCredentials('Insufficient credits to use IP2Location service.');
117117
} elseif (preg_match('/invalid ip address/i', $data['response'])) {
118118
throw new UnsupportedOperation('Invalid IP address.');
119119
} else {
120-
throw new UnsupportedOperation('Unexpected error.');
120+
throw new UnsupportedOperation(sprintf('Unexpected error: %s.', $data['response']));
121121
}
122122
}
123123

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
s:54:"{"response":"Invalid API key or insufficient credit."}";

0 commit comments

Comments
 (0)