Fix unclear error when clubs db uri is missing or empty

Open Beginner friendly
#379 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
go, mongodb
Domain
backend, databases

Research direction

Start in configs/setup.go around line 130 and trace the CLUBS_DB_URI loading and Clubs database connection path. Compare the missing and empty URI cases, including db.PingContext(ctx), and verify that errors identify the Clubs Database, include the ping error where applicable, and avoid an unnecessary stack trace.

Written by the indexing model from the issue text.

Description

good first issue L1

when clubs db uri is empty, the user
When missing:

panic: Error loading 'CLUBS_DB_URI' from the .env file

This is a good error, and makes it clear whats wrong, but it prints a stack trace, which isn't necessary for this error, use log.Fatal instead of log.Panic to remove the stack trace

When Empty:

2026/04/09 20:39:37 Connected to MongoDB
20:39:37 .../configs/setup.go:130: Unable to ping database

Seeing this error, it almost looks as go-api is unable to ping MongoDB since that's what comes right before. Instead it's because of an empty/wrong CLUBS_DB_URI, and it wasn't able to ping the Clubs Database. Make it clearer that the issue is with connecting to the Clubs Database, and print the specific error that comes from db.PingContext(ctx) with the error message.

Dominant language
Go
Stars
39
Forks
94
Avg merge
10h 43m
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from UTDNebula/nebula-api

All issues in UTDNebula/nebula-api

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.