backend: membership errorhandling tests

This commit is contained in:
Alex
2025-02-28 10:05:25 +01:00
parent 386b50e857
commit 20754b4422
4 changed files with 17 additions and 15 deletions

View File

@@ -132,7 +132,7 @@ func (mc *MembershipController) DeleteSubscription(c *gin.Context) {
if err := mc.Service.DeleteSubscription(&data.Subscription.ID, &data.Subscription.Name); err != nil {
if err == errors.ErrNoData {
utils.RespondWithError(c, err, "Missing subscription name during deletion", http.StatusExpectationFailed, errors.Responses.Fields.SubscriptionModel, errors.Responses.Keys.Invalid)
} else if err == errors.ErrNotFound {
} else if err == errors.ErrSubscriptionNotFound {
utils.RespondWithError(c, err, "Subscription not found", http.StatusNotFound, errors.Responses.Fields.SubscriptionModel, errors.Responses.Keys.NotFound)
} else if err == errors.ErrInvalidSubscriptionData {
utils.RespondWithError(c, err, "Invalid subscription data", http.StatusBadRequest, errors.Responses.Fields.SubscriptionModel, errors.Responses.Keys.Invalid)