Browse Source

Small changes

customisations
alemart 10 months ago
parent
commit
02701f4c51
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      src/core/session.ts

+ 4
- 3
src/core/session.ts View File

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

Loading…
Cancel
Save