@hackthedev/dsync-ipsec 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.mjs +13 -11
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -179,16 +179,18 @@ export default class dSyncIPSec {
179
179
  }
180
180
 
181
181
  // make request to get ip info
182
- let ipRequest = await fetch(`https://api.ipapi.is/?q=${ip}`);
183
- if (ipRequest.status === 200) {
184
- let ipData = await ipRequest.json();
185
-
186
- // possibility to set cache
187
- if(this.setCache && typeof this.setCache === "function") await this.setCache(ip, ipData);
188
-
189
- return ipData;
190
- } else {
191
- return {error: "Failed to fetch IP data"};
192
- }
182
+ try{
183
+ let ipRequest = await fetch(`https://api.ipapi.is/?q=${ip}`);
184
+ if (ipRequest.status === 200) {
185
+ let ipData = await ipRequest.json();
186
+
187
+ // possibility to set cache
188
+ if(this.setCache && typeof this.setCache === "function") await this.setCache(ip, ipData);
189
+
190
+ return ipData;
191
+ } else {
192
+ return {error: "Failed to fetch IP data"};
193
+ }
194
+ }catch{}
193
195
  }
194
196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hackthedev/dsync-ipsec",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "IP Based Security Library against Abuse",
5
5
  "license": "ISC",
6
6
  "author": "",