diff --git a/nixie/cli.py b/nixie/cli.py index fb4df86..e560bfc 100644 --- a/nixie/cli.py +++ b/nixie/cli.py @@ -22,7 +22,6 @@ import shutil import sys import tempfile -import traceback import typing from contextlib import contextmanager from pathlib import Path @@ -108,7 +107,7 @@ async def wait_for_proc( """Wait for a process to complete and return its success status and stderr.""" try: _, stderr = await asyncio.wait_for(proc.communicate(), timeout) - except asyncio.TimeoutError: + except TimeoutError: proc.kill() await proc.wait() print(f"{path}: diagram {idx} timed out", file=sys.stderr) @@ -212,16 +211,11 @@ async def render_block( except FileNotFoundError as exc: cli = exc.filename or "mmdc" print( - "Error: '{0}' not found. Install Node.js with npx or Bun to use @mermaid-js/mermaid-cli.".format( - cli - ), + f"Error: '{cli}' not found. Install Node.js with npx or Bun to use @mermaid-js/mermaid-cli.", file=sys.stderr, ) except RuntimeError as exc: print(exc, file=sys.stderr) - except Exception as exc: - print(f"{path}: unexpected error in diagram {idx}", file=sys.stderr) - traceback.print_exception(type(exc), exc, exc.__traceback__, file=sys.stderr) else: return True return False diff --git a/nixie/unittests/test_render_diagram.py b/nixie/unittests/test_render_diagram.py index 1e5d21f..be58b83 100644 --- a/nixie/unittests/test_render_diagram.py +++ b/nixie/unittests/test_render_diagram.py @@ -1,5 +1,4 @@ from __future__ import annotations - import asyncio import logging import shlex