Skip to content

Commit b357e2b

Browse files
chrisrink10Christopher Rink
andauthored
Add line and column information to exceptions from reading reader conditionals (#855)
Fixes #854 --------- Co-authored-by: Christopher Rink <[email protected]>
1 parent c12c5d1 commit b357e2b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
### Fixed
1616
* Fix a bug where `basilisp.lang.compiler.exception.CompilerException` would nearly always suppress line information in it's `data` map (#845)
1717
* Fix a bug where the function returned by `partial` retained the meta, arities, and `with_meta` method of the wrapped function rather than creating new ones (#847)
18+
* Fix a bug where exceptions arising while reading reader conditional forms did not include line and column information (#854)
1819

1920
## [v0.1.0b1]
2021
### Added

src/basilisp/lang/reader.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,10 @@ def _read_reader_macro(ctx: ReaderContext) -> LispReaderForm: # noqa: MC0001
14841484
elif token == "!":
14851485
return _read_comment(ctx)
14861486
elif token == "?":
1487-
return _read_reader_conditional(ctx)
1487+
try:
1488+
return _read_reader_conditional(ctx)
1489+
except SyntaxError as e:
1490+
raise ctx.syntax_error(e.message).with_traceback(e.__traceback__) from None
14881491
elif token == "#":
14891492
return _read_numeric_constant(ctx)
14901493
elif token == "b":
@@ -1499,7 +1502,9 @@ def _read_reader_macro(ctx: ReaderContext) -> LispReaderForm: # noqa: MC0001
14991502
try:
15001503
return f(v)
15011504
except SyntaxError as e:
1502-
raise ctx.syntax_error(e.message).with_traceback(e.__traceback__)
1505+
raise ctx.syntax_error(e.message).with_traceback(
1506+
e.__traceback__
1507+
) from None
15031508
elif s.ns is None and "." in s.name:
15041509
return _load_record_or_type(ctx, s, v)
15051510
else:

0 commit comments

Comments
 (0)