google / google/python-fire

How can i access the exception that fire handles?

オープン
#209 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
28.2k
フォーク
1.5k
PR マージ指標
30日以内にマージされた PR はありません

説明

I know that whether I am using a class or a function, fire will internally handle the exception and show the help if there is an issue.

So considering `fire_obj = fire.Fire(SomeClass)`, how can I access that exception from fire_obj? I know that fire_obj points to a new instance of SomeClass, but I am trying to capture and handle the exceptions that fire is handling internally when it shows the help or exceptions.

When I wrap it in a try except, I can see that the exception is `FireExit`, but I dont want the python-fire help message to print (which is printing from the code in the library). I want to instead raise my own exception, but even better, access the exception that happened inside `SomeClass` which is trigger the error.

@dbieber

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。