mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 15:15:33 +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
|
@ -111,13 +111,15 @@ pub fn run(
|
|||
{
|
||||
eprintln!(
|
||||
r#"
|
||||
{}: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:
|
||||
{}{} {} If you could open an issue at:
|
||||
|
||||
https://github.com/astral-sh/ruff/issues/new?title=%5BPanic%5D
|
||||
https://github.com/astral-sh/ruff/issues/new?title=%5BPanic%5D
|
||||
|
||||
quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!
|
||||
...quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!
|
||||
"#,
|
||||
"error".red().bold(),
|
||||
":".bold(),
|
||||
"Ruff crashed.".bold(),
|
||||
);
|
||||
}
|
||||
default_panic_hook(info);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue