🚀 Feature request
Add an option to fail on class initialization.
Motivation
Currently if a config contains a class_path with init_args, and it fails to initialize the class it will ignore the error, and just return a dict/namespace. If the class contains a error it's unclear what the issue is requiring the user to use a debugger or to test it outside of the script that uses jsonargparse.
See the code (on line 1054-1055 any exception is ignored):
https://github.com/omni-us/jsonargparse/blob/7da8b8247c3e447386da599e441d4ac5cfee67e9/jsonargparse/typehints.py#L1044-L1055
Note: I am not aware of the full impact, and I think it's possible that simply raising this exception always is not enough as it might fail too often as well in valid use cases. E.g. check_values in https://github.com/omni-us/jsonargparse/blob/927ec027f41520cc768d501387ea678a096848c8/jsonargparse/core.py#L1074 raises an exception for a case which I think is valid.
Pitch
I would like to have an option to fail in cases where initializing a class fails, and raise the exception of the underlying code.
Alternatives
An alternative is to fail always, but this could be considered a breaking change.
🚀 Feature request
Add an option to fail on class initialization.
Motivation
Currently if a config contains a class_path with init_args, and it fails to initialize the class it will ignore the error, and just return a dict/namespace. If the class contains a error it's unclear what the issue is requiring the user to use a debugger or to test it outside of the script that uses jsonargparse.
See the code (on line 1054-1055 any exception is ignored):
https://github.com/omni-us/jsonargparse/blob/7da8b8247c3e447386da599e441d4ac5cfee67e9/jsonargparse/typehints.py#L1044-L1055
Note: I am not aware of the full impact, and I think it's possible that simply raising this exception always is not enough as it might fail too often as well in valid use cases. E.g. check_values in https://github.com/omni-us/jsonargparse/blob/927ec027f41520cc768d501387ea678a096848c8/jsonargparse/core.py#L1074 raises an exception for a case which I think is valid.
Pitch
I would like to have an option to fail in cases where initializing a class fails, and raise the exception of the underlying code.
Alternatives
An alternative is to fail always, but this could be considered a breaking change.