Skip to content

speech: improve error handling #451

Description

@broady

Steps to reproduce:

$ cd nodejs-docs-samples/speech
$ node recognize.js sync recognize.js
ERROR: [TypeError: Cannot read property 'alternatives' of undefined]

(also note a healthy exit code)

Activity

  1. broady commented on Aug 10, 2017

    @broady
    ContributorAuthor
    $ for i in $(seq 10); do cat resources/audio.raw resources/quit.raw; done > resources/big.raw
    $ node recognize.js stream resources/big.raw
    /usr/local/google/home/cbro/src/github.com/GoogleCloudPlatform/nodejs-docs-samples/speech/recognize.js:383
              `Transcription: ${data.results[0].alternatives[0].transcript}`);
                                               ^
    
    TypeError: Cannot read property 'alternatives' of undefined
        at null.<anonymous> (/usr/local/google/home/cbro/src/github.com/GoogleCloudPlatform/nodejs-docs-samples/speech/recognize.js:383:44)
        at emitOne (events.js:77:13)
        at emit (events.js:169:7)
        at addChunk (/usr/local/google/home/cbro/src/github.com/GoogleCloudPlatform/nodejs-docs-samples/speech/node_modules/readable-stream/lib/_stream_readable.js:284:12)
        at readableAddChunk (/usr/local/google/home/cbro/src/github.com/GoogleCloudPlatform/nodejs-docs-samples/speech/node_modules/readable-stream/lib/_stream_readable.js:271:11)
        at Readable.push (/usr/local/google/home/cbro/src/github.com/GoogleCloudPlatform/nodejs-docs-samples/speech/node_modules/readable-stream/lib/_stream_readable.js:238:10)
        at Duplexify._forward (/usr/local/google/home/cbro/src/github.com/GoogleCloudPlatform/nodejs-docs-samples/speech/node_modules/duplexify/index.js:163:26)
        at DestroyableTransform.onreadable (/usr/local/google/home/cbro/src/github.com/GoogleCloudPlatform/nodejs-docs-samples/speech/node_modules/duplexify/index.js:127:10)
        at emitNone (events.js:67:13)
        at DestroyableTransform.emit (events.js:166:7)
    Exit code 1
    
  2. fhinkel commented on Nov 8, 2018

    @fhinkel
    Contributor

    If the issue still persists, please file it here. Thank you.

  3. added a commit that references this issue on Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚨This issue needs some love.triage meI really want to be triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions