@adobe/spacecat-shared-ahrefs-client 1.6.11 → 1.6.12
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 +7 -0
- package/package.json +1 -1
- package/src/index.js +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@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)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **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))
|
|
7
|
+
|
|
1
8
|
# [@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
9
|
|
|
3
10
|
|
package/package.json
CHANGED
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
|
-
|
|
68
|
-
|
|
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 {
|