@artsnoa/ipc-sdk 1.0.0 → 1.0.1

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.
package/dist/index.js CHANGED
@@ -56,7 +56,7 @@ function sanitizeBaseUrl(url) {
56
56
  if (error instanceof IPCError) {
57
57
  throw error;
58
58
  }
59
- throw new IPCError(`Invalid base URL: ${url}`);
59
+ throw new IPCError("Invalid base URL format. Please provide a valid HTTPS URL");
60
60
  }
61
61
  }
62
62
  function buildUrl(baseUrl, path) {
@@ -124,10 +124,10 @@ async function makeRequest(url, apiKey, timeout) {
124
124
  let errorCode;
125
125
  try {
126
126
  const errorData = await response.json();
127
- if (errorData.message) {
127
+ if (errorData && errorData.message) {
128
128
  errorMessage = errorData.message;
129
129
  }
130
- if (errorData.code) {
130
+ if (errorData && errorData.code) {
131
131
  errorCode = errorData.code;
132
132
  }
133
133
  } catch {
@@ -149,11 +149,9 @@ async function makeRequest(url, apiKey, timeout) {
149
149
  throw error;
150
150
  }
151
151
  if (error instanceof TypeError) {
152
- throw new IPCError(`Network error: ${error.message}`);
152
+ throw new IPCError("Network error occurred. Please check your connection and try again");
153
153
  }
154
- throw new IPCError(
155
- error instanceof Error ? error.message : "An unknown error occurred"
156
- );
154
+ throw new IPCError("An unexpected error occurred. Please try again later");
157
155
  }
158
156
  }
159
157
 
package/dist/index.mjs CHANGED
@@ -29,7 +29,7 @@ function sanitizeBaseUrl(url) {
29
29
  if (error instanceof IPCError) {
30
30
  throw error;
31
31
  }
32
- throw new IPCError(`Invalid base URL: ${url}`);
32
+ throw new IPCError("Invalid base URL format. Please provide a valid HTTPS URL");
33
33
  }
34
34
  }
35
35
  function buildUrl(baseUrl, path) {
@@ -97,10 +97,10 @@ async function makeRequest(url, apiKey, timeout) {
97
97
  let errorCode;
98
98
  try {
99
99
  const errorData = await response.json();
100
- if (errorData.message) {
100
+ if (errorData && errorData.message) {
101
101
  errorMessage = errorData.message;
102
102
  }
103
- if (errorData.code) {
103
+ if (errorData && errorData.code) {
104
104
  errorCode = errorData.code;
105
105
  }
106
106
  } catch {
@@ -122,11 +122,9 @@ async function makeRequest(url, apiKey, timeout) {
122
122
  throw error;
123
123
  }
124
124
  if (error instanceof TypeError) {
125
- throw new IPCError(`Network error: ${error.message}`);
125
+ throw new IPCError("Network error occurred. Please check your connection and try again");
126
126
  }
127
- throw new IPCError(
128
- error instanceof Error ? error.message : "An unknown error occurred"
129
- );
127
+ throw new IPCError("An unexpected error occurred. Please try again later");
130
128
  }
131
129
  }
132
130
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsnoa/ipc-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "TypeScript SDK for IPC API - IP address and country lookup",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",