Skip to content

Commit 89fed42

Browse files
yog27rayclaude
andcommitted
fix: Wrap DataCloneError in Parse.Error for non-cloneable context values
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b6a7713 commit 89fed42

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

spec/ParseServerRESTController.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,8 @@ describe('ParseServerRESTController', () => {
605605
fail('should have rejected for non-cloneable context');
606606
} catch (error) {
607607
expect(error).toBeDefined();
608-
expect(error.name).toEqual('DataCloneError');
608+
expect(error.code).toEqual(Parse.Error.INVALID_VALUE);
609+
expect(error.message).toContain('Context contains non-cloneable values');
609610
}
610611
});
611612

src/ParseServerRESTController.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ function ParseServerRESTController(applicationId, router) {
115115
try {
116116
requestContext = structuredClone(options.context || {});
117117
} catch (error) {
118-
reject(error);
118+
reject(
119+
new Parse.Error(
120+
Parse.Error.INVALID_VALUE,
121+
`Context contains non-cloneable values: ${error.message}`
122+
)
123+
);
119124
return;
120125
}
121126
getAuth(options, config).then(auth => {

0 commit comments

Comments
 (0)