More documentation for MemoryStore error codes

DataStores have some really nice documentation for errors: Data Stores | Documentation - Roblox Creator Hub

MemoryStores lack this documentation, which is annoying for two reasons:

  1. 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).
  2. 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.

2 Likes

that error code is very straightforward, especially considering that it tells you that it needs a key parameter which is a string

what other examples are there of bad documentation?

Also if you didn’t know, if a parameter isn’t required when calling a function it would look like this

UpdateAsync(key: string?)
1 Like

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.

1 Like

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.

1 Like

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!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.