Skip to content

Commit 6253721

Browse files
♲ Improve error messaging for unexpected conditions in SQL parser
1 parent 08f6c7a commit 6253721

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

frontend/packages/db-structure/src/parser/sql/postgresql/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ export const processor: Processor = async (sql: string) => {
3333
const { parse_tree, error: parseError } = await parse(chunk)
3434

3535
if (parse_tree.stmts.length > 0 && parseError !== null) {
36-
throw new Error('UnexpectedCondition')
36+
throw new Error(
37+
'UnexpectedCondition. parse_tree.stmts.length > 0 && parseError !== null',
38+
)
3739
}
3840

3941
if (parseError !== null) {

frontend/packages/db-structure/src/parser/sql/postgresql/processSQLInChunks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const processSQLInChunks = async (
7070
} else if (readOffset !== null) {
7171
const lineNumber = getLineNumber(chunk, readOffset)
7272
if (lineNumber === null) {
73-
throw new Error('UnexpectedCondition')
73+
throw new Error('UnexpectedCondition. lineNumber === null')
7474
}
7575
i += lineNumber
7676
break

0 commit comments

Comments
 (0)