[server][cast] Fix err handling

This commit is contained in:
Neeraj Gupta 2024-05-03 12:36:02 +05:30
parent 627eab472c
commit a62edad446

View file

@ -16,6 +16,9 @@ type Repository struct {
func (r *Repository) AddCode(ctx context.Context, pubKey string, ip string) (string, error) {
codeValue, err := random.GenerateAlphaNumString(6)
if err != nil {
return "", err
}
_, err = r.DB.ExecContext(ctx, "INSERT INTO casting (code, public_key, id, ip) VALUES ($1, $2, $3, $4)", codeValue, pubKey, uuid.New(), ip)
if err != nil {
return "", err