[BUG] CLI crashes with raw traceback on non-UTF-8 .dmai files
評価
調査の方向性
Start in maithili_dsl/cli.py at run_dmai_file, where the file is read outside the try/except, and look at how existing errors print Maithili messages and pick exit codes. Wrap the read so a UnicodeDecodeError or OSError produces a friendly message and a non-zero exit. Done means a non-UTF-8 temp file in tests/test_cli.py gives the expected exit code with no traceback. Pull request #61 is already open against this issue, so check it before starting.
索引モデルが issue の本文から書いたものです。
説明
File: maithili_dsl/cli.py (run_dmai_file)
The file is read outside the try/except, so a .dmai file that is not valid UTF-8 crashes the CLI with a raw Python traceback instead of a friendly Maithili error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
(Verified against v0.3.0 with a UTF-16-encoded file.)
Fix: wrap the read in try/except (UnicodeDecodeError, OSError), print a Maithili error message (see existing style, e.g. ⚠️ त्रुटि: फाइल UTF-8 में नहि अछि।), and return a non-zero exit code (reuse EXIT_NOT_FOUND or add EXIT_BAD_ENCODING = 7 and document it).
Tests: tests/test_cli.py — write a non-UTF8 temp file, assert exit code and no traceback.
Good first issue: small, contained, and a nice tour of the CLI error-handling style.
- 主要言語
- Python
- スター
- 1
- フォーク
- 4
- 平均マージ
- 12日 21時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
alphacrack/python-maithili-dsl のほかの issue
-
help wanted infra P2 testing
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
documentation enhancement good first issue help wanted P3
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
documentation good first issue P3
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
area:linter enhancement good first issue P3 translation
難易度 2/5 半日 初心者へのやさしさ 66/100
-
area:cli enhancement good first issue P3
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
alphacrack/python-maithili-dsl の issue をすべて見る
似ている issue
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
JheysonJhordyHuarauyaRiquelme/sprocguard#18 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
dlq/synthpopcan#59 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mdn/translated-content#40220 ·
メンテナーはふだん 4 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
ETSInitiative/PETSIRD#243 ·
メンテナーはふだん 1 日以内に返信
-
deferred p2
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
cuadrao-ai/argus#2160 ·
メンテナーはふだん 1 日以内に返信