Base class for get model names activity
[osm/common.git] / osm_common / temporal_exceptions.py
index 275bc45..df730a4 100644 (file)
 # 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)