diff --git a/packages/old-import/src/mappers/map-item.ts b/packages/old-import/src/mappers/map-item.ts index 2b11118be..a4faeed58 100644 --- a/packages/old-import/src/mappers/map-item.ts +++ b/packages/old-import/src/mappers/map-item.ts @@ -15,7 +15,7 @@ export const mapApp = ( boardSize: BoardSize, appsMap: Map, sectionMap: Map, -): InferInsertModel => { +): InferInsertModel | null => { if (app.area.type === "sidebar") throw new Error("Mapping app in sidebar is not supported"); const shapeForSize = app.shape[boardSize]; @@ -25,7 +25,8 @@ export const mapApp = ( const sectionId = sectionMap.get(app.area.properties.id)?.id; if (!sectionId) { - throw new Error(`Failed to find section for app appId='${app.id}' sectionId='${app.area.properties.id}'`); + logger.warn(`Failed to find section for app appId='${app.id}' sectionId='${app.area.properties.id}'. Removing app`); + return null; } return { @@ -69,9 +70,10 @@ export const mapWidget = ( const sectionId = sectionMap.get(widget.area.properties.id)?.id; if (!sectionId) { - throw new Error( - `Failed to find section for widget widgetId='${widget.id}' sectionId='${widget.area.properties.id}'`, + logger.warn( + `Failed to find section for widget widgetId='${widget.id}' sectionId='${widget.area.properties.id}'. Removing widget`, ); + return null; } return { diff --git a/packages/old-import/src/prepare/prepare-items.ts b/packages/old-import/src/prepare/prepare-items.ts index e82d6043c..b099433cf 100644 --- a/packages/old-import/src/prepare/prepare-items.ts +++ b/packages/old-import/src/prepare/prepare-items.ts @@ -10,5 +10,5 @@ export const prepareItems = ( ) => widgets .map((widget) => mapWidget(widget, boardSize, appsMap, sectionMap)) - .filter((widget) => widget !== null) - .concat(apps.map((app) => mapApp(app, boardSize, appsMap, sectionMap))); + .concat(apps.map((app) => mapApp(app, boardSize, appsMap, sectionMap))) + .filter((widget) => widget !== null);