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

Uncaught TypeError in FormatModel.js #9

Open
Icewav3 opened this issue Dec 11, 2023 · 0 comments
Open

Uncaught TypeError in FormatModel.js #9

Icewav3 opened this issue Dec 11, 2023 · 0 comments

Comments

@Icewav3
Copy link

Icewav3 commented Dec 11, 2023

Firstly disclaimer, as I am not very familiar with js I have used chatGPT to try to make sure I have all the information you may need. Hope it worked ok haha!

Description:
I encountered an Uncaught TypeError in the FormatModel.js file while using the library in a specific context. The error occurs within the onresult callback of the SpeechRecognitionModel.js file. Here are the details:

Error Message:

Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at _default.splitlines (FormatModel.js:37:18)
    at FormatModel.js:7:38
    at Array.map (<anonymous>)
    at _default.format (FormatModel.js:7:24)
    at HomeModel.js:59:45
    at _this.engine.onresult (SpeechRecognitionModel.js:38:11)

Reproduction Steps:
Use the following code to reproduce the issue in the console:

// Example usage to reproduce the issue
const formatter = new FormatModel();
const formattedText = formatter.format([" nothing nothing's working here"], 5, 80);
console.log(formattedText);

Additional Information:
The strs parameter in the format method is expected to be an array.
The error seems to be related to the input data or the context in which the FormatModel is being used.
The issue is not reproduced with the provided example code, but it occurs within the onresult callback of the SpeechRecognitionModel.js file.

Possible Suggestions:
Add additional logging in the splitlines method to identify the values causing the issue.
Check the input array strs in the format method to ensure it contains valid strings.

Environment Information:
Chrome Version 120.0.6099.71 (Official Build) (64-bit)

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

No branches or pull requests

1 participant