obs-transcript icon indicating copy to clipboard operation
obs-transcript copied to clipboard

Uncaught TypeError in FormatModel.js

Open Icewav3 opened this issue 2 years ago • 0 comments

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)

Icewav3 avatar Dec 11 '23 22:12 Icewav3