@adobe/spacecat-shared-ahrefs-client 1.6.11 → 1.6.13

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@adobe/spacecat-shared-ahrefs-client-v1.6.13](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-ahrefs-client-v1.6.12...@adobe/spacecat-shared-ahrefs-client-v1.6.13) (2025-04-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update adobe fixes ([#673](https://github.com/adobe/spacecat-shared/issues/673)) ([69d9f99](https://github.com/adobe/spacecat-shared/commit/69d9f99a563eb229171f3c3ffdbdc5a29a6e002b))
7
+
8
+ # [@adobe/spacecat-shared-ahrefs-client-v1.6.12](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-ahrefs-client-v1.6.11...@adobe/spacecat-shared-ahrefs-client-v1.6.12) (2025-03-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **ahrefs-client:** log error message for not ok responses ([#658](https://github.com/adobe/spacecat-shared/issues/658)) ([4dc106a](https://github.com/adobe/spacecat-shared/commit/4dc106afaef19045636dd83d447d78e5af548f0d))
14
+
1
15
  # [@adobe/spacecat-shared-ahrefs-client-v1.6.11](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-ahrefs-client-v1.6.10...@adobe/spacecat-shared-ahrefs-client-v1.6.11) (2025-03-04)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-ahrefs-client",
3
- "version": "1.6.11",
3
+ "version": "1.6.13",
4
4
  "description": "Shared modules of the Spacecat Services - Ahrefs Client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@adobe/fetch": "4.2.0",
38
- "@adobe/helix-universal": "5.0.9",
38
+ "@adobe/helix-universal": "5.1.1",
39
39
  "@adobe/spacecat-shared-utils": "1.26.4"
40
40
  },
41
41
  "devDependencies": {
package/src/index.js CHANGED
@@ -64,8 +64,17 @@ export default class AhrefsAPIClient {
64
64
  + `total cost: ${response.headers.get('x-api-units-cost-total-actual')}`);
65
65
 
66
66
  if (!response.ok) {
67
- this.log.error(`Ahrefs API request failed with status: ${response.status}`);
68
- throw new Error(`Ahrefs API request failed with status: ${response.status}`);
67
+ let errorMessage = `Ahrefs API request failed with status: ${response.status}`;
68
+ try {
69
+ const errorBody = await response.json();
70
+ if (hasText(errorBody.error)) {
71
+ errorMessage += ` - ${errorBody.error}`;
72
+ }
73
+ } catch (e) {
74
+ this.log.error(`Error parsing Ahrefs API error response: ${e.message}`);
75
+ }
76
+ this.log.error(errorMessage);
77
+ throw new Error(errorMessage);
69
78
  }
70
79
 
71
80
  try {