Commit 567e812
committed
Improve syntax error reporting by adding file context
When syntax errors occur during file loading, the error messages now
include the source file name through call_with_error_context/2 as
recommended in issue mthom#302.
Before:
error(syntax_error(incomplete_reduction),read_term/3:8).
After:
error(syntax_error(incomplete_reduction),[file-'test_file.pl'|read_term/3:8]).
This approach uses the existing call_with_error_context/2 mechanism
instead of modifying the core error struct, following the established
pattern for enhancing error context in Scryer Prolog.
Changes:
- Modified stream_next_term/4 in src/loader.pl to wrap read_term/3
calls with call_with_error_context/2, providing file context when
available
Resolves: mthom#302
Related: mthom#31331 parent e4d9692 commit 567e812
1 file changed
+8
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
206 | 212 | | |
207 | 213 | | |
208 | 214 | | |
| |||
0 commit comments