-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
[bugfix] Encode unicode error message response #5687
Conversation
59a9b51
to
ad4c25f
Compare
Codecov Report
@@ Coverage Diff @@
## master #5687 +/- ##
==========================================
- Coverage 63.49% 63.49% -0.01%
==========================================
Files 360 360
Lines 22914 22934 +20
Branches 2551 2555 +4
==========================================
+ Hits 14550 14562 +12
- Misses 8349 8357 +8
Partials 15 15
Continue to review full report at Codecov.
|
superset/views/base.py
Outdated
@@ -45,7 +45,7 @@ def get_error_msg(): | |||
|
|||
def json_error_response(msg=None, status=500, stacktrace=None, payload=None, link=None): | |||
if not payload: | |||
payload = {'error': str(msg)} | |||
payload = {'error': msg.encode('utf-8')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that is py3 compatible, go with '{}'.format(msg)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mistercrunch Thank you for reminding. updated commit
* Fix unicode error message response * Update
When response error is unicode object, raise UnicodeEncodeError