Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not log traceback if file has skip_file comment #416

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bundled/tool/lsp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,12 @@ def _run_tool_on_document(
cwd=cwd,
source=source,
)
except isort.exceptions.FileSkipComment:
log_warning(f"Skipping file with 'skip_file' comment: {document.path}")
return None
except isort.exceptions.FileSkipped:
log_warning(traceback.format_exc(chain=True))
# Ignore file skipped.
return None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returning None avoids an uncaught LSP server error:

Screenshot 2024-07-05 at 12 10 24 AM

except Exception:
log_error(traceback.format_exc(chain=True))
raise
Expand Down
Loading