@upyo/mailgun 0.2.0-dev.22 → 0.2.0-dev.26
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.cjs +10 -6
- package/dist/index.js +10 -6
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -82,14 +82,18 @@ var MailgunHttpClient = class {
|
|
|
82
82
|
for (let attempt = 0; attempt <= this.config.retries; attempt++) try {
|
|
83
83
|
const response = await this.fetchWithAuth(url, options);
|
|
84
84
|
const text = await response.text();
|
|
85
|
-
|
|
85
|
+
if (!response.ok) {
|
|
86
|
+
let errorMessage;
|
|
87
|
+
try {
|
|
88
|
+
errorMessage = JSON.parse(text)?.message;
|
|
89
|
+
} catch {}
|
|
90
|
+
throw new MailgunApiError(errorMessage || text || `HTTP ${response.status}`, response.status);
|
|
91
|
+
}
|
|
86
92
|
try {
|
|
87
|
-
|
|
88
|
-
} catch {
|
|
89
|
-
throw new Error(
|
|
93
|
+
return JSON.parse(text);
|
|
94
|
+
} catch (jsonError) {
|
|
95
|
+
throw new Error(`Successfully received response but failed to parse JSON: ${jsonError.message}`);
|
|
90
96
|
}
|
|
91
|
-
if (!response.ok) throw new MailgunApiError(data.message ?? `HTTP ${response.status}`, response.status);
|
|
92
|
-
return data;
|
|
93
97
|
} catch (error) {
|
|
94
98
|
lastError = error instanceof Error ? error : new Error(String(error));
|
|
95
99
|
if (error instanceof MailgunApiError && error.statusCode && error.statusCode >= 400 && error.statusCode < 500) throw error;
|
package/dist/index.js
CHANGED
|
@@ -81,14 +81,18 @@ var MailgunHttpClient = class {
|
|
|
81
81
|
for (let attempt = 0; attempt <= this.config.retries; attempt++) try {
|
|
82
82
|
const response = await this.fetchWithAuth(url, options);
|
|
83
83
|
const text = await response.text();
|
|
84
|
-
|
|
84
|
+
if (!response.ok) {
|
|
85
|
+
let errorMessage;
|
|
86
|
+
try {
|
|
87
|
+
errorMessage = JSON.parse(text)?.message;
|
|
88
|
+
} catch {}
|
|
89
|
+
throw new MailgunApiError(errorMessage || text || `HTTP ${response.status}`, response.status);
|
|
90
|
+
}
|
|
85
91
|
try {
|
|
86
|
-
|
|
87
|
-
} catch {
|
|
88
|
-
throw new Error(
|
|
92
|
+
return JSON.parse(text);
|
|
93
|
+
} catch (jsonError) {
|
|
94
|
+
throw new Error(`Successfully received response but failed to parse JSON: ${jsonError.message}`);
|
|
89
95
|
}
|
|
90
|
-
if (!response.ok) throw new MailgunApiError(data.message ?? `HTTP ${response.status}`, response.status);
|
|
91
|
-
return data;
|
|
92
96
|
} catch (error) {
|
|
93
97
|
lastError = error instanceof Error ? error : new Error(String(error));
|
|
94
98
|
if (error instanceof MailgunApiError && error.statusCode && error.statusCode >= 400 && error.statusCode < 500) throw error;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upyo/mailgun",
|
|
3
|
-
"version": "0.2.0-dev.
|
|
3
|
+
"version": "0.2.0-dev.26+8f57766a",
|
|
4
4
|
"description": "Mailgun transport for Upyo email library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"email": "hong@minhee.org",
|
|
15
15
|
"url": "https://hongminhee.org/"
|
|
16
16
|
},
|
|
17
|
-
"homepage": "https://upyo.org/",
|
|
17
|
+
"homepage": "https://upyo.org/transports/mailgun",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git+https://github.com/dahlia/upyo.git",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": false,
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@upyo/core": "0.2.0-dev.
|
|
56
|
+
"@upyo/core": "0.2.0-dev.26+8f57766a"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@dotenvx/dotenvx": "^1.47.3",
|