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

Improve error message for non-existent local files #6608

Merged

Commits on Nov 8, 2015

  1. Improve error message for non-existent local files

    I received multiple reports about the following cryptic error in the
    Chrome extension when the user tried to open a local file:
    
    > PDF.js v1.1.527 (build: 2096a2a)
    > Message: Cannot read property 'Symbol(Symbol.iterator)' of null
    
    This error most likely originated from core/stream.js:
    
        function Stream(arrayBuffer, start, length, dict) {
          this.bytes = (arrayBuffer instanceof Uint8Array ?
                        arrayBuffer : new Uint8Array(arrayBuffer));
                                                     ^^^^^^^^^^^
    `arrayBuffer` is `null`, and that in turn is caused by the fact that
    for non-existing files, there is no data. I've applied two fixes:
    
    1. Never call onDone with a void buffer, but call the error handler
       instead.
    2. Show a sensible error message for local files with status = 0.
    Rob--W committed Nov 8, 2015
    Configuration menu
    Copy the full SHA
    c604cc2 View commit details
    Browse the repository at this point in the history