Skip to content

Commit 15a8e9c

Browse files
committed
throw error for input validation
1 parent 4ecb265 commit 15a8e9c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

common/src/util/partial-json-delta.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ export function getPartialJsonDelta(
7272
result: Record<string, any>
7373
lastParam: { key: string | undefined; complete: boolean }
7474
} {
75+
if (!content.startsWith(previous)) {
76+
throw new Error(
77+
`Content must be previous content plus new content. Content ${JSON.stringify(content)} does not start with previous content ${JSON.stringify(previous)}`
78+
)
79+
}
7580
const {
7681
lastParamComplete,
7782
params: current,

0 commit comments

Comments
 (0)