MemoryStores lack this documentation, which is annoying for two reasons:
I can’t write code that makes decisions based on the returned error code (e.g. should the code keep retrying a request, or should it just give up immediately).
I don’t know what the error codes mean.
As an example of the latter, I got this cryptic error today when calling SortedMap:UpdateAsync():
Code: 2, Error: The key field is required.
I didn’t know what this error means. I had to figure it out myself by trial and error: the key parameter to UpdateAsync cannot be an empty string.
The issue was about providing the empty string as an argument, not about missing an argument entirely.
The specific case that triggered the error was this:
SortedMap:UpdateAsync(game.JobId, ...)
game.JobId is the empty string "" in Studio test sessions, but I had never really considered how the SortedMap would behave when given an empty string for the key argument.
The error message in this case is bad because it says nothing about a function parameter/argument that is not allowed to be the empty string. Instead the message makes it seems like there’s a table field somewhere which is completely missing.
The type-checking (and the autocomplete popup) for this function only deal with the generic string type, so they don’t provide any helpful information in this scenario.
I get what you’re saying, but still, even then you can infer that there is an issue and it’s not accepting the key parameter you passed. I would print it out and debug to figure out why that is and assume it’s because the string is empty.
Hello @EmeraldSlash , thank you for flagging! The Observability Dashboard provides insights and analytics for monitoring and troubleshooting memory store usage, and we added in status codes for both server and client side to the Memory Stores guide. I hope this helps!