File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
localstack-core/localstack/aws Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 33from collections .abc import Callable
44from typing import Any , NamedTuple
55
6+ import moto .core .exceptions
67from botocore import xform_name
78from botocore .model import ServiceModel
89
@@ -151,6 +152,14 @@ def invoke(self, context: RequestContext) -> Response:
151152 raise NotImplementedError
152153
153154 return self .dispatch_request (serializer , context , instance )
155+ except moto .core .exceptions .ServiceException as moto_exc :
156+ # Translate Moto ServiceException into native one.
157+ # This gracefully handles errors when provider handlers invoke Moto methods directly.
158+ exc = CommonServiceException (
159+ code = moto_exc .code ,
160+ message = moto_exc .message ,
161+ )
162+ return self .on_service_exception (serializer , context , exc )
154163 except ServiceException as e :
155164 return self .on_service_exception (serializer , context , e )
156165 except NotImplementedError as e :
You can’t perform that action at this time.
0 commit comments