steam
steam copied to clipboard
SteamID: make_steam64 should either raise on invalid input, or always return invalid SteamID
Spawned from #259
invalid SteamID
= SteamID(0, EType.Invalid, EUniverse.Invalid, 0)
For numeric input, invalid values do not raise, and instead create a invalid SteamID
instance:
https://github.com/ValvePython/steam/blob/92c5107c7c300d55d37d9e681de8394d78fca841/steam/steamid.py#L296-L298
For string input, invalid values do not raise, and instead create a invalid SteamID
instance:
https://github.com/ValvePython/steam/blob/92c5107c7c300d55d37d9e681de8394d78fca841/steam/steamid.py#L310-L311
For out of bounds, we raise some times.
I think all input should be validated, and if its out of bounds, raise. Then the user can create a invalid SteamID
instance if needed (which is technically not out of bounds). This will additionally, make catching bad input, and potential changes the SteamID
format by Valve. Explicit is better.
If we silently ignore out of bounds conditions, and return invalid SteamID
instance, then that can result in unexpected behavior. Suppose SteamID
is initialized before queries are made for database. Then suppose, Valve adds a new type, that the code can't handle. All valid SteamIDs
will then turn into invalid SteamID
and will silently be collapsed under a single SteamID
. That is bad