X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_common%2Ftemporal_exceptions.py;h=df730a4629ee099f9a76be4d8c18d8dc3f2390f9;hb=0a28d984ff2622a719d882168b220d001108db40;hp=275bc450da8105c6b52230e4a398cbfab2acfcb1;hpb=293a515829350c27cb832dc062bca14e627e736d;p=osm%2Fcommon.git diff --git a/osm_common/temporal_exceptions.py b/osm_common/temporal_exceptions.py index 275bc45..df730a4 100644 --- a/osm_common/temporal_exceptions.py +++ b/osm_common/temporal_exceptions.py @@ -13,29 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -from functools import wraps - from temporalio.exceptions import ApplicationError -class RetryableException(ApplicationError): +class NonRetryableException(ApplicationError): def __init__(self, message): - super().__init__(message, non_retryable=False) - + super().__init__(message, non_retryable=True) -def wrap_exceptions(error_message="Unhandled exception"): - def Inner(func): - @wraps(func) - async def wrapper(*args, **kwargs): - try: - return await func(*args, **kwargs) - except Exception as err: - if isinstance(err, RetryableException): - raise err - raise ApplicationError( - f"{error_message}: {str(err)}", non_retryable=True - ) from err - return wrapper - - return Inner +class TimeOutError(ApplicationError): + def __init__(self, message): + super().__init__(message)