Skip to content

Promise-fulfillment swallows exception #1

@ouhouhsami

Description

@ouhouhsami

It's a knows bug/feature: kriskowal/q#30

  // We need an audio context to decode the file
  // By default, buffer-loader search for audioContext in the window.
  var audioContext = new AudioContext();

  // Load the file passing the path
  var myBufferLoader = createBufferLoader();
  myBufferLoader.load('FILE_URL').then(
      function(buffer){
        // Here we throw an Error
        // But without the done function below, the error would have been swallowed
        throw new Error('Error');
      }
  ).done(
    function(result){
      console.log(result); // Here we will get the error
    }
  );

So, for the moment, the solution to catch programmatic errors is to use done()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions