Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [v1.29.2](https://github.com/contentstack/contentstack-management-javascript/tree/v1.29.2) (2026-04-06)

- Fix
- 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)
- Enh
- Dependency update: bump `lodash` to `4.18.1` to address reported vulnerabilities

## [v1.29.1](https://github.com/contentstack/contentstack-management-javascript/tree/v1.29.1) (2026-03-23)

- Fix
Expand Down
6 changes: 4 additions & 2 deletions lib/contentstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ import { getContentstackEndpoint } from '@contentstack/utils'
* @example //Set the `logHandler`
* import * as contentstack from '@contentstack/management'
* const client = contentstack.client({ logHandler: (level, data) => {
if (level === 'error' && data) {
const title = [data.name, data.message].filter((a) => a).join(' - ')
if (level === 'error' && data != null && data !== '') {
const title = typeof data === 'string'
? data
: [data.name, data.message].filter((a) => a).join(' - ') || (data.code ? String(data.code) : 'request or network error')
console.error(`An error occurred due to ${title}. Review the details and try again.`)
return
}
Expand Down
15 changes: 13 additions & 2 deletions lib/core/contentstackHTTPClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,19 @@ export default function contentstackHttpClient (options) {
insecure: false,
retryOnError: true,
logHandler: (level, data) => {
if (level === 'error' && data) {
const title = [data.name, data.message].filter((a) => a).join(' - ')
if (level === 'error' && data != null && data !== '') {
let title
if (typeof data === 'string') {
title = data
} else {
title = [data.name, data.message].filter((a) => a).join(' - ')
if (!title && typeof data === 'object' && data.code) {
title = String(data.code)
}
}
if (!title) {
title = 'request or network error'
}
console.error(ERROR_MESSAGES.ERROR_WITH_TITLE(title))
return
}
Expand Down
Loading
Loading