Browse Source

Small changes

customisations
alemart 1 year ago
parent
commit
be3c890c69
2 changed files with 16 additions and 7 deletions
  1. 11
    3
      src/core/session.ts
  2. 5
    4
      src/utils/utils.ts

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

562
                 // update internals
562
                 // update internals
563
                 this._updateStats.update();
563
                 this._updateStats.update();
564
                 this._frameReady = true;
564
                 this._frameReady = true;
565
-            }).catch((err: any) => {
565
+            }).catch(err => {
566
                 // log error
566
                 // log error
567
                 Utils.error('Tracking error: ' + err.toString(), err);
567
                 Utils.error('Tracking error: ' + err.toString(), err);
568
 
568
 
569
-                // throw WebGL errors
570
-                if(err.name == 'GLError' || (typeof err.cause == 'object' && err.cause.name == 'GLError')) {
569
+                // handle WebGL errors
570
+                const cause = (err as any).cause;
571
+                if(err.name == 'GLError') {
571
                     alert(err.message); // fatal error?
572
                     alert(err.message); // fatal error?
573
+                    alert(Utils.deviceInfo()); // display useful info
574
+                    throw err;
575
+                }
576
+                else if(typeof cause == 'object' && cause.name == 'GLError') {
577
+                    alert(err.message);
578
+                    alert(cause.message);
579
+                    alert(Utils.deviceInfo());
572
                     throw err;
580
                     throw err;
573
                 }
581
                 }
574
             });
582
             });

+ 5
- 4
src/utils/utils.ts View File

167
      */
167
      */
168
     static deviceInfo(): string
168
     static deviceInfo(): string
169
     {
169
     {
170
-        return JSON.stringify({
170
+        return 'Device info: ' + JSON.stringify({
171
             isIOS: Utils.isIOS(),
171
             isIOS: Utils.isIOS(),
172
             isWebKit: Utils.isWebKit(),
172
             isWebKit: Utils.isWebKit(),
173
             renderer: Speedy.Platform.renderer,
173
             renderer: Speedy.Platform.renderer,
174
             vendor: Speedy.Platform.vendor,
174
             vendor: Speedy.Platform.vendor,
175
-            screen: [screen.width, screen.height].toString(),
175
+            screen: [screen.width, screen.height].join('x'),
176
+            platform: [navigator.platform, navigator.vendor].join('; '),
176
             userAgent: navigator.userAgent,
177
             userAgent: navigator.userAgent,
177
-            platform: [Utils.platformString(), navigator.platform, navigator.vendor],
178
-        }, null, 4);
178
+            userAgentData: (navigator as any).userAgentData || null,
179
+        }, null, 2);
179
     }
180
     }
180
 }
181
 }

Loading…
Cancel
Save