Skip to content

Commit 91e0aee

Browse files
committed
fix(collection-flow): change error handling to warnings in status setter
- Replace error throwing with console warnings for missing state - Adapt handling of invalid status to log a warning instead (With these warning messages, your error handling is now as soft as a pillow fight)
1 parent 0f588b7 commit 91e0aee

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/common/src/utils/collection-flow/set-collection-flow-status.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ export const setCollectionFlowStatus = (
1212
status: CollectionFlowStatuses,
1313
) => {
1414
if (!context.collectionFlow?.state) {
15-
throw new Error('Collection flow state is not present.');
15+
console.warn('Collection flow state is not present.');
16+
17+
return context;
1618
}
1719

1820
if (!(status in CollectionFlowStatusesEnum)) {
19-
throw new Error(`Invalid status: ${status}`);
21+
console.warn(`Invalid status: ${status}`);
22+
23+
return context;
2024
}
2125

2226
context.collectionFlow.state.status = status;

0 commit comments

Comments
 (0)