The tool is just throwing an exception on errors, but we should capture them and write better error messages. For example, without support for PostgreSQL URLs proposed in #5, we get this error:
mats@fury:~/work/timescale/doctor$ timescale-doctor postgres://mats@localhost/hax0r
Traceback (most recent call last):
File "/home/mats/.local/bin/timescale-doctor", line 8, in <module>
sys.exit(main())
File "/home/mats/.local/lib/python3.10/site-packages/doctor/__init__.py", line 39, in main
rules.check_rules(user=args.user, dbname=args.dbname, port=args.port, host=args.host)
File "/home/mats/.local/lib/python3.10/site-packages/doctor/rules/__init__.py", line 113, in check_rules
conn = psycopg2.connect(dbname=dbname, user=user,
File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "postgres://mats@localhost/hax0r" does not exist
The tool is just throwing an exception on errors, but we should capture them and write better error messages. For example, without support for PostgreSQL URLs proposed in #5, we get this error: