Skip to content

Commit 4e1b01e

Browse files
authored
Improve error messages for debug during scope creation (#770)
Improve panic message formatting during scope query generation to enhance developer experience through more readable and informative error output when scope query generation fails.
1 parent 3e00599 commit 4e1b01e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

crates/core/src/models/scopes.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,26 @@ impl SourceCodeUnit {
7777
break;
7878
}
7979
}
80-
panic!("Could not create scope query for {scope_level:?}");
80+
panic!(
81+
"
82+
=====================================
83+
ERROR: Failed to create scope query
84+
=====================================
85+
86+
Scope Level: {}
87+
88+
Source Code:
89+
-------------------------------------
90+
{}
91+
92+
AST S-expression:
93+
-------------------------------------
94+
{}
95+
=====================================",
96+
scope_level,
97+
self.code(),
98+
root_node.to_sexp()
99+
);
81100
}
82101
}
83102

0 commit comments

Comments
 (0)