-
Notifications
You must be signed in to change notification settings - Fork 817
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] Exception when receive messages from javascript #975
base: develop
Are you sure you want to change the base?
Conversation
String handleJsMessage(Object? jsMessage) { | ||
return switch (jsMessage) { | ||
String message => message, | ||
Map map => jsonEncode(map), |
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.
if it's already a map, do we need to encode and decode ?
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.
This is not always a map... I'm encoding at this moment to make as less changes as possible in the existing logic
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've separated this logic into two distinct handlers in this commit: Improve web controller's JS message deserialization
return switch (jsMessage) { | ||
String message => message, | ||
Map map => jsonEncode(map), | ||
Object? data => throw Exception( |
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.
Let's fail silently
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.
Implemented in this commit: refactor: fail silently when handleJsMessage
This is urgent because it does not serve web |
Sometimes Javascript is returning messages that are
Map
instead ofString
and it's throwing an exception.Snapshot