Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: ObjectLoader caches error responses as legitimate content #1973

Open
gouldingken opened this issue Jan 17, 2024 · 0 comments
Open

Bug: ObjectLoader caches error responses as legitimate content #1973

gouldingken opened this issue Jan 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@gouldingken
Copy link

When using ObjectLoader, if the object ID does not match the streamID, you will see an error like this because it tries to directly parse the server response:

"Failed to "... is not valid JSON

Once the ID issue is fixed, the ObjectLoader should be able to load the data from the object ID. However when using the cache, the object ID for the "Failed to" error message is stored in the cache so the fix will not be successful.

Solution

In ObjectLoader: implement better handling of error messages from the server and do not store these in the cache.

The JSON parse error is coming from line:

return { id: pieces[0], obj: JSON.parse(pieces[1]) }

The cache issue could be solved by checking the validity of objects before placing in the cache, but more robust error handling is likely preferable:

store.put(idAndData[1], idAndData[0])

@gouldingken gouldingken added the bug Something isn't working label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant