Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago committed Mar 12, 2024
1 parent 495bc64 commit 10b13cd
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion lib/database/bootstrapper_runtime/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def handler(event, context):
# Custom eoAPI user/password/dbname parameters
eoapi_params = get_secret(params["new_user_secret_arn"])

print("Connecting to RDS...")
print("Connecting to Postgres instance...")
rds_conninfo = make_conninfo(
dbname=admin_params.get("dbname", "postgres"),
user=admin_params["username"],
Expand Down Expand Up @@ -260,6 +260,30 @@ def handler(event, context):
with PgstacDB(dsn=eoapi_user_dsn, debug=True) as pgdb:
print(f" OK - User has access to pgstac db, pgstac schema version: {pgdb.version}")

except psycopg.Error as e:
print(e.diag.column_name)
print(e.diag.constraint_name)
print(e.diag.context)
print(e.diag.datatype_name)
print(e.diag.internal_position)
print(e.diag.internal_query)
print(e.diag.message_detail)
print(e.diag.message_hint)
print(e.diag.message_primary)
print(e.diag.schema_name)
print(e.diag.severity)
print(e.diag.severity_nonlocalized)
print(e.diag.source_file)
print(e.diag.source_function)
print(e.diag.source_line)
print(e.diag.sqlstate)
print(e.diag.statement_position)
print(e.diag.table_name)

print(f"Unable to bootstrap database with exception={e}")
send(event, context, "FAILED", {"message": str(e)})
raise e

except Exception as e:
print(f"Unable to bootstrap database with exception={e}")
send(event, context, "FAILED", {"message": str(e)})
Expand Down

0 comments on commit 10b13cd

Please sign in to comment.