mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-11 22:28:27 +00:00
Catch panics in formatter (#7377)
## Summary This PR ensures that we catch and render panics in the formatter identically to other kinds of errors. It also improves the consistency in error rendering throughout and makes a few stylistic changes to the messages. Closes https://github.com/astral-sh/ruff/issues/7247. ## Test Plan I created a file `foo.py` with a syntax error, and a file `bar.py` with an intentional panic. <img width="1624" alt="Screen Shot 2023-09-13 at 10 25 22 PM" src="605c2839
-ad02-4376-a2e9-d5a593ab660f"> <img width="1624" alt="Screen Shot 2023-09-13 at 10 25 24 PM" src="b1381909
-157c-48cb-9630-d0bbfcb1b640">
This commit is contained in:
parent
ec2f229a45
commit
5d21b9c22e
5 changed files with 61 additions and 32 deletions
|
@ -120,7 +120,7 @@ impl From<ParseError> for FormatModuleError {
|
|||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(level=Level::TRACE, skip_all, err)]
|
||||
#[tracing::instrument(level=Level::TRACE, skip_all)]
|
||||
pub fn format_module(
|
||||
contents: &str,
|
||||
options: PyFormatOptions,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue