google / google/python-fire

How can i access the exception that fire handles?

Offen
#209 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
28.2k
Forks
1.5k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.