Fix review issues: error handling, stdin TTY hint, narrow exceptions - Handle UnicodeDecodeError and PermissionError for file reading - Show hint when stdin is a TTY and no file given - Narrow JSON fallback exception from Exception to (SyntaxError, ValueError) - Rename 'type' parameter to 'file_type' to avoid shadowing builtin - Remove dead '.R' entry from EXTENSION_MAP

This commit is contained in:
2026-04-01 16:02:56 -07:00
parent 1abfcebc24
commit 5db15a8a17
3 changed files with 13 additions and 5 deletions

View File

@@ -39,7 +39,7 @@ def render(
elif file_type in _JSON_TYPES:
try:
renderable = RichJSON(content)
except Exception:
except (SyntaxError, ValueError):
renderable = Syntax(
content, "json", theme=options.theme, line_numbers=line_numbers
)