Skip to content

Commit bf5daae

Browse files
fix(plugin-stack-persistence): wrap save failures in StackSnapshotRecordSaveError (#733)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f52b5f4 commit bf5daae

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@stackflow/plugin-stack-persistence": patch
3+
---
4+
5+
Wrap storage save failures in `StackSnapshotRecordSaveError` before invoking `onRecordSaveError` or rethrowing, matching the declared handler signature and the load-path behavior.

extensions/plugin-stack-persistence/src/stackPersistencePlugin.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ export function stackPersistencePlugin<Metadata>(
3030
snapshot,
3131
metadata
3232
}).catch(error => {
33-
if (onRecordSaveError) return onRecordSaveError(error);
34-
else throw error;
33+
const saveError = new StackSnapshotRecordSaveError(error);
34+
35+
if (onRecordSaveError) return onRecordSaveError(saveError);
36+
else throw saveError;
3537
});
3638
}
3739

0 commit comments

Comments
 (0)