pepkit / pepdbagent

Database for storing sample metadata
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

Dont exit program on failure to connect #11

Closed nleroy917 closed 1 year ago

nleroy917 commented 1 year ago

I noticed that the PepAgent will call a sys.exit() when it fails to connect to the database. I think that it should just report the error instead of exiting out of whatever program is utilizing it.

nleroy917 commented 1 year ago

I think raising an error would be a lot better in this case. That way, users can wrap things in a try: catch:

Actually, psycopg will raise an error when it can't connect. Maybe we just let it do its thing. No need for a custom exception. It will raise an exception letting us know there was an error connecting.