Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Commit ebec69d

Browse files
author
Olumuyiwa Osiname
committed
fix(sync): enhance error handling and logging for folder sync operations
1 parent 2c4f79e commit ebec69d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/tasks/sync.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ const SyncSpaces = {
125125
const { data } = await this.client.get('spaces/' + this.targetSpaceId + '/stories', { with_slug: story.full_slug })
126126
const existingStory = data.stories[0]
127127
const storyData = await this.getStoryWithTranslatedSlugs(sourceStory, existingStory ? existingStory[0] : null)
128+
128129
await this.updateStoriesAndFolders(storyData, existingStory, sourceStory)
129130
} catch (e) {
130131
console.error(
@@ -167,6 +168,7 @@ const SyncSpaces = {
167168
const { data } = await this.client.get(`spaces/${this.targetSpaceId}/stories`, targetFolderParams)
168169
const existingFolder = data.stories[0] || null
169170
const folderData = await this.getStoryWithTranslatedSlugs(folderResult.data.story, existingFolder)
171+
170172
delete folderData.id
171173
delete folderData.created_at
172174

@@ -192,6 +194,10 @@ const SyncSpaces = {
192194

193195
await this.updateStoriesAndFolders(folderData, existingFolder, folder, true)
194196
} catch (e) {
197+
if (e.response.includes('You cannot change the is_folder attribute.')) {
198+
console.log(chalk.yellow('-') + ` Folder ${folder.name} is already a story in the target space ${this.targetSpaceId} and cannot be synced as a folder`)
199+
continue
200+
}
195201
console.error(
196202
chalk.red('X') + ` Folder ${folder.name} Sync failed: ${e.message}`
197203
)

0 commit comments

Comments
 (0)