@malloydata/malloy 0.0.16-dev221216125519 → 0.0.16-dev221217002701

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.
@@ -2140,7 +2140,8 @@ class SQLStatement extends MalloyElement {
2140
2140
  sqlDefEntry.reference(sql.name, this.location);
2141
2141
  const lookup = sqlDefEntry.getEntry(sql.name);
2142
2142
  if (lookup.status == "error") {
2143
- this.select.log(`'Schema error: ${lookup.message}`);
2143
+ const msgLines = lookup.message.split(/\r?\n/);
2144
+ this.select.log("Invalid SQL, " + msgLines.join("\n "));
2144
2145
  return undefined;
2145
2146
  }
2146
2147
  if (lookup.status == "present") {
@@ -1280,6 +1280,22 @@ describe("error handling", () => {
1280
1280
  test("popping out of embedding when not embedded", () => {
1281
1281
  expect("}%").compileToFailWith("extraneous input '}%' expecting {<EOF>, EXPLORE, QUERY, SOURCE, SQL, IMPORT, ';'}");
1282
1282
  });
1283
+ test("bad sql in sql block", () => {
1284
+ const badModel = new BetaModel(`sql: { select: """)""" }`);
1285
+ expect(badModel).modelParsed();
1286
+ const needSchema = badModel.translate();
1287
+ expect(needSchema.compileSQL).toBeDefined();
1288
+ if (needSchema.compileSQL) {
1289
+ badModel.update({
1290
+ errors: {
1291
+ compileSQL: {
1292
+ [needSchema.compileSQL.name]: "ZZZZ",
1293
+ },
1294
+ },
1295
+ });
1296
+ }
1297
+ expect(badModel).compileToFailWith("Invalid SQL, ZZZZ");
1298
+ });
1283
1299
  });
1284
1300
  function getSelectOneStruct(sqlBlock) {
1285
1301
  const selectThis = sqlBlock.select[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.16-dev221216125519",
3
+ "version": "0.0.16-dev221217002701",
4
4
  "license": "GPL-2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",