def _parse_event_exception()

in amazon_transcribe/deserialize.py [0:0]


    def _parse_event_exception(self, raw_event) -> ServiceException:
        exception_type: str = raw_event.headers.get(
            ":exception-type", "ServiceException"
        )
        exception_cls: Type[ServiceException] = getattr(
            transcribe_exceptions, exception_type, ServiceException
        )
        try:
            raw_body = json.loads(raw_event.payload)
        except ValueError:
            raw_body = {}
        exception_msg = raw_body.get("Message", "An unknown service exception occured")
        return exception_cls(exception_msg)