Skip to content

Commit 4d14fb6

Browse files
jmgilmanminikin
andauthored
fix: prints connection errors for dbsync (#691)
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. Fixes # (issue) _if applicable_ ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Test A - [ ] Test B **Test Configuration**: _if applicable_ - Firmware version: - Hardware: - Toolchain: - SDK: **List of new dependencies**: _if applicable_ Provide a list of newly added dependencies in this PR, with the description of what are they doing and why do we need them. - Crate A: description - Crate B: description ## Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Co-authored-by: Oleksandr Prokhorenko <djminikin@gmail.com>
1 parent 317d2d4 commit 4d14fb6

File tree

1 file changed

+4
-4
lines changed
  • utilities/ideascale-importer/ideascale_importer/db

1 file changed

+4
-4
lines changed

utilities/ideascale-importer/ideascale_importer/db/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,12 @@ async def connect(url: str, *args, **kwargs) -> asyncpg.Connection:
219219
"""
220220
try:
221221
conn = await asyncpg.connect(dsn=url, *args, **kwargs)
222-
except Exception as _:
223-
raise Exception("Database connection failed")
222+
except Exception as e:
223+
raise Exception(f"database connection failed: {e}")
224224

225225
try:
226226
await conn.set_type_codec("jsonb", encoder=json.dumps, decoder=json.loads, schema="pg_catalog")
227-
except Exception as _:
228-
raise Exception("Failed to set jsonb codec")
227+
except Exception as e:
228+
raise Exception(f"failed to set jsonb codec: {e}")
229229

230230
return conn

0 commit comments

Comments
 (0)