Skip to content

Can’t catch the 'All given promises failed' error. #86

@chrism

Description

@chrism

Hi, I’m using this approach to load my audio stream, which I took from this comment.
#36 (comment)

this.hifi.load([{ url: 'audio-url', mimeType: 'audio/mime'}])
.then(({ sound }) => {
  console.log('loaded sound', sound);
})
.catch(error => {
  console.log('FROM CATCH', error);
})
.finally(() => {
  console.log('finally')
});

When one of the audio streams in the array works, this works great.

A problem arises though if none of the sources are working.

The catch does log the error message, but there’s still an additional uncaught promise error—which looks to be coming from promise-race.

This output (with debug: true in the config)

ember-hifi                  |  given urls: http://not-audio.com/url
hifi-cache                  |  cache miss for http://not-audio.com/url
Could not determine mime type for http://not-audio.com/url
Attempting to play urls with an unknown mime type can be bad for performance. See documentation for more info.
Could not determine mime type for http://not-audio.com/url
Attempting to play urls with an unknown mime type can be bad for performance. See documentation for more info.
Attempting to play urls with an unknown mime type can be bad for performance. See documentation for more info.
ember-hifi                  |  Compatible connections for http://not-audio.com/url: NativeAudio, HLS, Howler
ember-hifi                  |  TRYING: [Native Audio] -> http://not-audio.com/url
not-audio.com/url:1 GET http://not-audio.com/url net::ERR_NAME_NOT_RESOLVED
ember-hifi                  |  FAILED: [Native Audio] -> Audio source format is not supported. (http://not-audio.com/url)
ember-hifi                  |  TRYING: [HLS] -> http://not-audio.com/url
xhr-loader.js:82 GET http://not-audio.com/url net::ERR_NAME_NOT_RESOLVED
ember-hifi                  |  FAILED: [HLS] -> manifestLoadError (http://not-audio.com/url)
ember-hifi                  |  TRYING: [Howler] -> http://not-audio.com/url
xhr-loader.js:82 GET http://not-audio.com/url net::ERR_NAME_NOT_RESOLVED
ember-hifi                  |  FAILED: [Howler] -> No codec support for selected audio sources. (http://not-audio.com/url)
ember-hifi                  |  All promises failed:
ember-hifi                  |  Native Audio: Audio source format is not supported.
ember-hifi                  |  HLS: manifestLoadError
ember-hifi                  |  Howler: No codec support for selected audio sources.
load-aro                    |  _findFirstPlayableSound took 1065ms
**FROM CATCH Error: [ember-hifi] URL Promise failed because: All given promises failed.**
    at hifi.js:223
    at invokeCallback (rsvp.js:493)
    at publish (rsvp.js:476)
    at publishRejection (rsvp.js:412)
    at rsvp.js:19
    at invoke (backburner.js:338)
    at Queue.flush (backburner.js:229)
    at DeferredActionQueues.flush (backburner.js:426)
    at Backburner._end (backburner.js:960)
    at Backburner._boundAutorunEnd (backburner.js:629)
**finally**
promise-race.js:43 Uncaught (in promise) Error: All given promises failed.
    at promise-race.js:43
    at invokeCallback (rsvp.js:493)
    at publish (rsvp.js:476)
    at publishRejection (rsvp.js:412)
    at rsvp.js:19
    at invoke (backburner.js:338)
    at Queue.flush (backburner.js:229)
    at DeferredActionQueues.flush (backburner.js:426)
    at Backburner._end (backburner.js:960)
    at Backburner._boundAutorunEnd (backburner.js:629)

I’d really like to find a way to suppress this error but I’m a bit lost as I feel like it should have already been caught by the load() promise catch?

Thanks for any help I’m struggling a bit with the docs on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions