-
-
Notifications
You must be signed in to change notification settings - Fork 589
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
Send/receive error details with widgets #4492
Merged
Merged
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b3ee054
Send/receive error details with widgets
AndrewFerr a6304ce
Fix embedded client tests
AndrewFerr d13c3d8
Use all properties of error responses
AndrewFerr 6b47e22
Lint
AndrewFerr b6f8d14
Rewrite ternary expression as if statement
AndrewFerr 156d29a
Put typehints on overridden functions
AndrewFerr fbf6a7d
Lint
AndrewFerr bc08a5d
Update matrix-widget-api
AndrewFerr 4e3c362
Don't @link across packages
AndrewFerr cdd1608
Add a missing docstring
AndrewFerr 2cecdd1
Set widget response error string to correct value
AndrewFerr b9591c1
Test conversion to/from widget error payloads
AndrewFerr bdefb0b
Test processing errors thrown by widget transport
AndrewFerr 21045a2
Lint
AndrewFerr ccfcda6
Test processing errors from transport.sendComplete
AndrewFerr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
Why do we need this bind?
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 used as a way to preserve the original
send
method so it can still be used by the function that replaces it.Alternatively this could have been an arrow function, but that would require specifying a parameter list. Using bind gets around that.
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 seems like a really nasty pattern, this looks like somewhere a subclass makes far more sense rather than overwriting class methods, what's the rationale for not doing it in a more conventional way?
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.
It's because the
send
methods don't belong toWidgetApi
, but toITransport
, meaning that subclassing (or even a composition-based approach) would have to work harder to get to them.Any non-
bind
approach I can think of ends up being more complicated / requires much more copied code than this.