Better error messages for st.cache#1146
Merged
tvst merged 33 commits intostreamlit:developfrom Mar 11, 2020
Merged
Conversation
jrhone
reviewed
Mar 6, 2020
jrhone
reviewed
Mar 6, 2020
jrhone
reviewed
Mar 6, 2020
jrhone
approved these changes
Mar 10, 2020
tconkling
added a commit
to tconkling/streamlit
that referenced
this pull request
Mar 11, 2020
* develop: Better error messages for st.cache (streamlit#1146) Fix st.cache (streamlit#1208) file_uploader: support for multiple files (streamlit#1183) Another attempt at test_multiple_scriptrunners timeouts (streamlit#1211) Speed up `make jstest` on CircleCI De-flake ScriptRunner_test.py (streamlit#1195)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This does a few things (apologies for the big PR!)
st.cacheby including the cache stack and the hashing reason. In the process, I moved the place where we product the message strings inside the Exception classes, since they're not used anywhere else.HashReasonenum.UserHashErrorshow up to the user not asUserHashErrorbut asFooError, for whatever FooError was actually thrown under the hood. This way the error is easier to Google.st.cachewarnings use Exceptions in order to produce a nice stack trace, and then makes them usest.exception()protos so their output looks more similar to the exception output. But since we want warnings to show up in yellow, this also adds anis_warningfield to exception protos that lets us tweak colors on the frontend.And some smaller things:
st.exception()always read tracebacks from their input Exception, rather than allow people to pass their own exceptions (since that last code path was not used anywhere in the code)._HashStacksuse weak references to threads rather than thread IDs, so avoid a memory leak when threads end.