|
@@ -324,7 +324,7 @@ export class Session extends AREventTarget<SessionEventType>
|
324
|
324
|
// attach trackers and return the session
|
325
|
325
|
return Speedy.Promise.all(
|
326
|
326
|
trackers.map(tracker => session._attachTracker(tracker))
|
327
|
|
- ).then(() => session);
|
|
327
|
+ ).then(() => session).catch(err => { throw err; });
|
328
|
328
|
|
329
|
329
|
}).catch(err => {
|
330
|
330
|
|
|
@@ -515,13 +515,14 @@ export class Session extends AREventTarget<SessionEventType>
|
515
|
515
|
/**
|
516
|
516
|
* Attach a tracker to the session
|
517
|
517
|
* @param tracker
|
|
518
|
+ * @returns a promise that resolves as soon as the tracker is attached and initialized
|
518
|
519
|
*/
|
519
|
520
|
private _attachTracker(tracker: Tracker): SpeedyPromise<void>
|
520
|
521
|
{
|
521
|
522
|
if(this._trackers.indexOf(tracker) >= 0)
|
522
|
|
- throw new IllegalArgumentError(`Duplicate tracker attached to the session`);
|
|
523
|
+ return Speedy.Promise.reject(new IllegalArgumentError(`Duplicate tracker attached to the session`));
|
523
|
524
|
else if(!this._active)
|
524
|
|
- throw new IllegalOperationError(`Inactive session`);
|
|
525
|
+ return Speedy.Promise.reject(new IllegalOperationError(`Inactive session`));
|
525
|
526
|
|
526
|
527
|
this._trackers.push(tracker);
|
527
|
528
|
return tracker._init(this);
|