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

Promise-fulfillment swallows exception #1

Open
ouhouhsami opened this issue Jun 4, 2014 · 0 comments
Open

Promise-fulfillment swallows exception #1

ouhouhsami opened this issue Jun 4, 2014 · 0 comments

Comments

@ouhouhsami
Copy link
Contributor

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()

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