BadgeService.AwardBadge does not throw any warning/error for invalid BadgeId (or badges that cannot be awarded in specific contexts)

When using BadgeService:AwardBadge(UserId, BadgeId) with an invalid BadgeId, it does not throw any warning regarding the validity of the badge.

Here is me testing with a wrong BadgeId I do not own:

This is me testing with a correct BadgeId that I own, BUT it is attached to another game:

As you can see, there are some scenarios that do not display any warning. The only ID that shows an actual warning is BadgeId = 0:

Other wrong (strictly positive) BadgeIds I tested do not print this message out. You do not receive any actual message.

NB: All screenshots were taken in a live server.

Expected behavior

I would expect this API to print out a warning, or even throw an error catchable via pcall. This API returns false whenever the BadgeId is wrong, but a warning would also be convenient, to understand where the problem is coming from. The warning appears for the ID 0, I suppose it should be extended to other invalid badge IDs.

The current behavior prompted a user to open a devforum post, filled with 40+ posts trying to figure out what the issue was. (Why won't BadgeService:AwardBadge() work)

4 Likes

Hello - your bug report describes the expected and documented behavior. However, we understand your intent and concern, so please feel free to open a feature request to improve the error logging.

1 Like