mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-24 02:14:27 +01:00
Merge 'Return better syntax error messages' from Diego Reis
Current error messages are too "low level", e.g returning tokens in
messages. This PR improves this a bit.
Before:
```text
turso> with t as (select * from pragma_schema_version); select c.schema_version from t as c;
× unexpected token at SourceSpan { offset: SourceOffset(47), length: 1 }
╭────
1 │ with t as (select * from pragma_schema_version); select c.schema_version from t as c;
· ┬
· ╰── here
╰────
help: expected [TK_SELECT, TK_VALUES, TK_UPDATE, TK_DELETE, TK_INSERT, TK_REPLACE] but found TK_SEMI
```
Now:
```text
turso> with t as (select * from pragma_schema_version); select c.schema_version from t as c;
× unexpected token ';' at offset 47
╭────
1 │ with t as (select * from pragma_schema_version);select c.schema_version from t as c;
· ┬
· ╰── here
╰────
help: expected SELECT, VALUES, UPDATE, DELETE, INSERT, or REPLACE but found ';'
```
@TcMits WDYT?
Closes #3190
This commit is contained in:
@@ -792,12 +792,12 @@ def test_csv():
|
||||
)
|
||||
turso.run_test_fn(
|
||||
"create virtual table t1 using csv(data='1'\\'2');",
|
||||
lambda res: "unrecognized token at" in res,
|
||||
lambda res: "unrecognized token " in res,
|
||||
"Create CSV table with malformed escape sequence",
|
||||
)
|
||||
turso.run_test_fn(
|
||||
"create virtual table t1 using csv(data=\"12');",
|
||||
lambda res: "non-terminated literal at" in res,
|
||||
lambda res: "non-terminated literal " in res,
|
||||
"Create CSV table with unterminated quoted string",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user