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

Added default onError prop to <Dictation /> #2866

Merged
merged 3 commits into from
Feb 5, 2020

Conversation

tonyanziano
Copy link
Contributor

Changelog Entry

  • Added default onError prop to the Dictation component, by @tonyanziano, in PR #2866

Description

Added a default onError prop to the <Dictation /> component so that errors caught by the <Dictation /> component will be surfaced in the console.

Specific Changes

Added a default onError prop to the <Dictation /> component so that errors caught by the <Dictation /> component will be surfaced in the console.

===

Let me know if didn't follow a pattern correctly. I'm not very familiar with hooks or the Web Chat code base.

@tonyanziano
Copy link
Contributor Author

tonyanziano commented Feb 4, 2020

After some investigation, I think that my changes did not introduce a new error that is breaking the tests, but instead surfaced a preexisting error that is now breaking the tests.

It's hard to tell for sure without the ability to set breakpoints within the component package during test runs.

However, all my changes did was make it so that the <Dictation /> component calls console.error(<exception>) whenever there is an error with speech / dictation. The test that is breaking clicks the microphone button, and that makes sure that no errors were logged via console.error().

Before my changes, this test never failed because it was impossible for the component to call console.error() with an undefined error handler. However, now that the handler is defined, an error will cause the component to log a console error which then fails the test. The interesting part is that the error is just an empty string.

If I change my handler to do nothing, or to log to console.warn() / .info() / .log() then the test passes.

===

I was using useMemo() incorrectly. 😅

Copy link
Contributor

@corinagum corinagum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Sorry for the delay :)

@tonyanziano
Copy link
Contributor Author

@corinagum no worries, I didn't fix it until yesterday 😃

@tonyanziano tonyanziano merged commit 7efc568 into master Feb 5, 2020
@tonyanziano tonyanziano deleted the toanzian/dictation-err branch February 5, 2020 19:06
@compulim compulim mentioned this pull request Mar 5, 2020
40 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants