When the stream request got rejected, for example it's cancelled by user, the req.message does not have the toJson method, caused one unrelated exception went to the error handler of API call, eventually we cannot consume the original error(like the AbortError) correctly.
This PR marked the toJson as optional to skip calling a undefined method.
Pros/cons of approach implemented
Checklist
[ ] Is this PR a reasonable size?
[ ] List deployment sequence with all relevant PRs.
...
Code Review Guidelines for Reviewers
Try to review in a timely manner. Opinions/nitpicks should not be blockers. Pair on a call for non-trivial feedback.
Overall design and approach should follow established patterns. Don't try to make the PR perfect.
Try to identify edge cases, race conditions, over-engineering, lack of test coverage and complexity.
If you don't feel qualified to review the code, pass it on to someone who is.
Summary
When the stream request got rejected, for example it's cancelled by user, the
req.message
does not have thetoJson
method, caused one unrelated exception went to the error handler of API call, eventually we cannot consume the original error(like the AbortError) correctly.This PR marked the
toJson
as optional to skip calling a undefined method.Pros/cons of approach implemented
Checklist
Code Review Guidelines for Reviewers