From 34f77edd68186f9f18cb8c918a776ecc1e43315e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Sat, 16 Dec 2023 12:39:30 -0600 Subject: [PATCH] fix(targets): Log sink when an unhandled error occurs during setup --- singer_sdk/target_base.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/singer_sdk/target_base.py b/singer_sdk/target_base.py index 01aed9891c..d3bc3d8a45 100644 --- a/singer_sdk/target_base.py +++ b/singer_sdk/target_base.py @@ -239,6 +239,9 @@ def add_sink( Returns: A new sink for the stream. + + Raises: + Exception: If sink setup fails. """ self.logger.info("Initializing '%s' target sink...", self.name) sink_class = self.get_sink_class(stream_name=stream_name) @@ -248,7 +251,13 @@ def add_sink( schema=schema, key_properties=key_properties, ) - sink.setup() + + try: + sink.setup() + except Exception: + self.logger.exception("Error initializing '%s' target sink", self.name) + raise + self._sinks_active[stream_name] = sink return sink