Skip to content

Commit 3016377

Browse files
committed
convert exceptions to logging errors
1 parent c0ed81d commit 3016377

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pylsp_ruff/plugin.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ def find_executable(executable) -> List[str]:
497497
if exe_path is not None:
498498
cmd = [exe_path]
499499
else:
500-
raise RuntimeError(f"configured ruff executable not found: {executable!r}")
500+
log.error(f"Configured ruff executable not found: {executable!r}")
501501

502502
# try the python module
503503
if cmd is None:
@@ -511,9 +511,10 @@ def find_executable(executable) -> List[str]:
511511
cmd = [system_exe]
512512

513513
if cmd is None:
514-
raise RuntimeError(
515-
"no suitable ruff invocation could be found (executable, python module)"
514+
log.error(
515+
"No suitable ruff invocation could be found (executable, python module)."
516516
)
517+
cmd = []
517518

518519
return cmd
519520

@@ -557,7 +558,7 @@ def run_ruff(
557558

558559
log.debug(f"Calling {cmd} on '{document_path}'")
559560
p = Popen(cmd, stdin=PIPE, stdout=PIPE)
560-
(stdout, stderr) = p.communicate(document_source.encode())
561+
(stdout, _) = p.communicate(document_source.encode())
561562

562563
if p.returncode != 0:
563564
log.error(f"Ruff returned {p.returncode} != 0")

0 commit comments

Comments
 (0)