Skip to content

Commit ec3ce22

Browse files
authored
fix(schema): Jinja - show source line in error message (#6885)
1 parent 9538e56 commit ec3ce22

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

packages/cubejs-backend-native/src/python/template/entry.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ impl<'a> NeonMiniJinjaContext for FunctionContext<'a> {
2828
content += &format!("{:>4} | {}\r\n", idx + 1, line);
2929
}
3030

31+
content += &format!("{:>4} > {}\r\n", idx + 1, lines[idx].1);
32+
3133
if let Some(_span) = err.range() {
3234
// TODO(ovr): improve
3335
content += &format!(

packages/cubejs-backend-native/test/__snapshots__/jinja.test.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ exports[`Jinja render template_error.jinja: template_error.jinja 1`] = `
232232
7 | 7
233233
8 | {%- for country in countries %}
234234
9 | 9
235+
10 > {%- unexpected_block_name %}
235236
i ^^^^^^^^^^^^^^^^^^^^^^^^ syntax error
236237
11 | 11
237238
12 | 12

0 commit comments

Comments
 (0)