added error handling

This commit is contained in:
Pavel 2024-06-11 19:08:22 +03:00
parent 30262442b2
commit 0013810bb8

@ -398,6 +398,9 @@ func (r *AccountRepository) GetLeadTarget(ctx context.Context, accountID string,
Quizid: quizID,
})
if err != nil {
if err == sql.ErrNoRows {
return nil, pj_errors.ErrNotFound
}
return nil, err
}
var leadTargets []model.LeadTarget
@ -422,7 +425,10 @@ func (r *AccountRepository) UpdateLeadTarget(ctx context.Context, req model.Lead
ID: req.ID,
})
if err != nil {
return model.LeadTarget{}, nil
if err == sql.ErrNoRows {
return model.LeadTarget{}, pj_errors.ErrNotFound
}
return model.LeadTarget{}, err
}
return model.LeadTarget{
ID: row.ID,