Skip to content
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

fix: better error handling for REST transport #1431

Merged
merged 3 commits into from
Mar 10, 2023
Merged

Conversation

alexander-fenster
Copy link
Contributor

@alexander-fenster alexander-fenster commented Mar 9, 2023

Fixes #1423.

In REST streaming use case, callback is not provided. Instead, the caller expects to see error events in the returned stream. If, for whatever reason, an error occurs in the streaming call, the caller would get TypeError: callback is not a function.

Make sure we only call callback if it's provided, and use the stream emitter to report errors in other cases.

Note: the unrelated change to mkdirp import is just because they are apparently making ESM related changes. It just makes our code compile again.

@alexander-fenster alexander-fenster requested review from a team as code owners March 9, 2023 21:01
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Mar 9, 2023
src/fallbackServiceStub.ts Outdated Show resolved Hide resolved
@alexander-fenster alexander-fenster merged commit 193b387 into main Mar 10, 2023
@alexander-fenster alexander-fenster deleted the callback-is-not branch March 10, 2023 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REST transport: callback is not a function
3 participants