Skip to content

Commit 6621e3b

Browse files
Merge pull request #538 from contentstack/development
DX | 06-04-2026 | Release
2 parents b8b3693 + b3f65af commit 6621e3b

File tree

5 files changed

+353
-10
lines changed

5 files changed

+353
-10
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [v1.29.2](https://github.com/contentstack/contentstack-management-javascript/tree/v1.29.2) (2026-04-06)
4+
5+
- Fix
6+
- Improve default `logHandler` error formatting when the error payload is a string (prevents blank "An error occurred due to ." messages during network/socket retry failures)
7+
- Enh
8+
- Dependency update: bump `lodash` to `4.18.1` to address reported vulnerabilities
9+
310
## [v1.29.1](https://github.com/contentstack/contentstack-management-javascript/tree/v1.29.1) (2026-03-23)
411

512
- Fix

lib/contentstack.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@ import { getContentstackEndpoint } from '@contentstack/utils'
120120
* @example //Set the `logHandler`
121121
* import * as contentstack from '@contentstack/management'
122122
* const client = contentstack.client({ logHandler: (level, data) => {
123-
if (level === 'error' && data) {
124-
const title = [data.name, data.message].filter((a) => a).join(' - ')
123+
if (level === 'error' && data != null && data !== '') {
124+
const title = typeof data === 'string'
125+
? data
126+
: [data.name, data.message].filter((a) => a).join(' - ') || (data.code ? String(data.code) : 'request or network error')
125127
console.error(`An error occurred due to ${title}. Review the details and try again.`)
126128
return
127129
}

lib/core/contentstackHTTPClient.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,19 @@ export default function contentstackHttpClient (options) {
1010
insecure: false,
1111
retryOnError: true,
1212
logHandler: (level, data) => {
13-
if (level === 'error' && data) {
14-
const title = [data.name, data.message].filter((a) => a).join(' - ')
13+
if (level === 'error' && data != null && data !== '') {
14+
let title
15+
if (typeof data === 'string') {
16+
title = data
17+
} else {
18+
title = [data.name, data.message].filter((a) => a).join(' - ')
19+
if (!title && typeof data === 'object' && data.code) {
20+
title = String(data.code)
21+
}
22+
}
23+
if (!title) {
24+
title = 'request or network error'
25+
}
1526
console.error(ERROR_MESSAGES.ERROR_WITH_TITLE(title))
1627
return
1728
}

0 commit comments

Comments
 (0)