return_on_exception

jwst.associations.lib.utilities.return_on_exception(exceptions=(<class 'Exception'>, ), default=None)[source]

Force functions raising exceptions to return a value.

This function returns a decorator to accomplish the value return.

Parameters:
exceptionstuple of Exception

Tuple of exceptions to catch.

defaultobj

The value to return when a specified exception occurs.

Returns:
decorator

The decorator to wrap functions that will return on certain exceptions.