google / google/python-fire

How can i access the exception that fire handles?

Ouverte
#209 8 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
28.2k
Forks
1.5k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.