File tree Expand file tree Collapse file tree 5 files changed +353
-10
lines changed
Expand file tree Collapse file tree 5 files changed +353
-10
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments