Use ".then(null, Cu.reportError);" with Promise.jsm

Paolo Amadini paolo.02.prg at amadzone.org
Sat Aug 10 13:36:35 UTC 2013


On 09/08/2013 23.25, Matt Brubeck wrote:
> On 8/9/2013 2:26 AM, Mike Ratcliffe wrote:
>> You should also be able to use:
>>    Task.spawn(function () {
>>      // yield ...
>>    }).then(null, console.error);
> Should we make this a default behavior in Task.jsm (when it's used in a
> scope where console.error or Cu.reportError are available)?

No, errors should not be reported if they're already caught by the
caller, that is a more common pattern:

  return Task.spawn(function () {
    // yield ...
  });

Paolo



More information about the firefox-dev mailing list