@blackcode_sa/metaestetics-api 1.5.48 → 1.5.49

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.
@@ -1717,6 +1717,7 @@ var BaseMailingService = class {
1717
1717
  throw new Error("Could not get Mailgun messages API");
1718
1718
  }
1719
1719
  messagesApi.send(data, (error, body) => {
1720
+ var _a, _b, _c;
1720
1721
  if (error) {
1721
1722
  if (error.statusCode === 401 || error.statusCode === 403) {
1722
1723
  const clientOptions = this.mailgunClient.options || {};
@@ -1727,9 +1728,24 @@ var BaseMailingService = class {
1727
1728
  statusCode: error.statusCode,
1728
1729
  domain: clientOptions.domain || "unknown",
1729
1730
  host: clientOptions.host || "default api.mailgun.net",
1730
- suggestion: "If using EU region domains, ensure host is set to 'api.eu.mailgun.net'"
1731
+ suggestion: "If using EU region domains, ensure host is set to 'api.eu.mailgun.net'",
1732
+ response: error.response ? JSON.stringify(error.response) : "No response details",
1733
+ request: error.request ? {
1734
+ method: (_a = error.request) == null ? void 0 : _a.method,
1735
+ path: (_b = error.request) == null ? void 0 : _b.path,
1736
+ host: (_c = error.request) == null ? void 0 : _c.host
1737
+ } : "No request details"
1731
1738
  }
1732
1739
  );
1740
+ const enhancedError = new Error(
1741
+ `Mailgun Authentication Error (${error.statusCode}): Possible EU region misconfiguration. Set host to 'api.eu.mailgun.net' for EU domains.`
1742
+ );
1743
+ enhancedError.originalError = error;
1744
+ enhancedError.mailgunConfig = {
1745
+ domain: clientOptions.domain,
1746
+ host: clientOptions.host
1747
+ };
1748
+ reject(enhancedError);
1733
1749
  } else {
1734
1750
  Logger.error("[BaseMailingService] Mailgun API error:", {
1735
1751
  error: error instanceof Error ? error.message : error,
@@ -1676,6 +1676,7 @@ var BaseMailingService = class {
1676
1676
  throw new Error("Could not get Mailgun messages API");
1677
1677
  }
1678
1678
  messagesApi.send(data, (error, body) => {
1679
+ var _a, _b, _c;
1679
1680
  if (error) {
1680
1681
  if (error.statusCode === 401 || error.statusCode === 403) {
1681
1682
  const clientOptions = this.mailgunClient.options || {};
@@ -1686,9 +1687,24 @@ var BaseMailingService = class {
1686
1687
  statusCode: error.statusCode,
1687
1688
  domain: clientOptions.domain || "unknown",
1688
1689
  host: clientOptions.host || "default api.mailgun.net",
1689
- suggestion: "If using EU region domains, ensure host is set to 'api.eu.mailgun.net'"
1690
+ suggestion: "If using EU region domains, ensure host is set to 'api.eu.mailgun.net'",
1691
+ response: error.response ? JSON.stringify(error.response) : "No response details",
1692
+ request: error.request ? {
1693
+ method: (_a = error.request) == null ? void 0 : _a.method,
1694
+ path: (_b = error.request) == null ? void 0 : _b.path,
1695
+ host: (_c = error.request) == null ? void 0 : _c.host
1696
+ } : "No request details"
1690
1697
  }
1691
1698
  );
1699
+ const enhancedError = new Error(
1700
+ `Mailgun Authentication Error (${error.statusCode}): Possible EU region misconfiguration. Set host to 'api.eu.mailgun.net' for EU domains.`
1701
+ );
1702
+ enhancedError.originalError = error;
1703
+ enhancedError.mailgunConfig = {
1704
+ domain: clientOptions.domain,
1705
+ host: clientOptions.host
1706
+ };
1707
+ reject(enhancedError);
1692
1708
  } else {
1693
1709
  Logger.error("[BaseMailingService] Mailgun API error:", {
1694
1710
  error: error instanceof Error ? error.message : error,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@blackcode_sa/metaestetics-api",
3
3
  "private": false,
4
- "version": "1.5.48",
4
+ "version": "1.5.49",
5
5
  "description": "Firebase authentication service with anonymous upgrade support",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -149,8 +149,29 @@ export class BaseMailingService {
149
149
  host: clientOptions.host || "default api.mailgun.net",
150
150
  suggestion:
151
151
  "If using EU region domains, ensure host is set to 'api.eu.mailgun.net'",
152
+ response: (error as any).response
153
+ ? JSON.stringify((error as any).response)
154
+ : "No response details",
155
+ request: (error as any).request
156
+ ? {
157
+ method: (error as any).request?.method,
158
+ path: (error as any).request?.path,
159
+ host: (error as any).request?.host,
160
+ }
161
+ : "No request details",
152
162
  }
153
163
  );
164
+
165
+ // Provide a more specific error object
166
+ const enhancedError = new Error(
167
+ `Mailgun Authentication Error (${error.statusCode}): Possible EU region misconfiguration. Set host to 'api.eu.mailgun.net' for EU domains.`
168
+ );
169
+ (enhancedError as any).originalError = error;
170
+ (enhancedError as any).mailgunConfig = {
171
+ domain: clientOptions.domain,
172
+ host: clientOptions.host,
173
+ };
174
+ reject(enhancedError);
154
175
  } else {
155
176
  Logger.error("[BaseMailingService] Mailgun API error:", {
156
177
  error: error instanceof Error ? error.message : error,