happy-sql 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 2026.08.20, v2.0.7
2
+
3
+ fix:
4
+ - 0ddbb26 happy-sql: parser: improve error message
5
+
1
6
  2026.08.20, v2.0.6
2
7
 
3
8
  feature:
@@ -26,14 +26,17 @@ const parseCstDialect = (source, dialect) => parseCst(source, {
26
26
  });
27
27
 
28
28
  export const parseSql = (source) => {
29
+ let cst;
30
+ let error;
31
+
29
32
  for (const dialect of DIALECTS) {
30
- const [, cst] = tryCatch(parseCstDialect, source, dialect);
33
+ [error, cst] = tryCatch(parseCstDialect, source, dialect);
31
34
 
32
35
  if (cst)
33
36
  return convertSource(cst);
34
37
  }
35
38
 
36
- throw Error(`Cannot parse SQL: '${source}'`);
39
+ throw error;
37
40
  };
38
41
 
39
42
  const isComment = ({text}) => text.startsWith('-- @');
@@ -88,3 +91,4 @@ const convertSource = (cst) => {
88
91
  expressionStatement(arrayExpression(elements)),
89
92
  ]));
90
93
  };
94
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happy-sql",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "type": "module",
5
5
  "description": "sql to js ast parser and printer",
6
6
  "exports": {