Przeglądaj źródła

Small changes

customisations
alemart 1 rok temu
rodzic
commit
be3c890c69
2 zmienionych plików z 16 dodań i 7 usunięć
  1. 11
    3
      src/core/session.ts
  2. 5
    4
      src/utils/utils.ts

+ 11
- 3
src/core/session.ts Wyświetl plik

@@ -562,13 +562,21 @@ export class Session extends AREventTarget<SessionEventType>
562 562
                 // update internals
563 563
                 this._updateStats.update();
564 564
                 this._frameReady = true;
565
-            }).catch((err: any) => {
565
+            }).catch(err => {
566 566
                 // log error
567 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 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 580
                     throw err;
573 581
                 }
574 582
             });

+ 5
- 4
src/utils/utils.ts Wyświetl plik

@@ -167,14 +167,15 @@ export class Utils
167 167
      */
168 168
     static deviceInfo(): string
169 169
     {
170
-        return JSON.stringify({
170
+        return 'Device info: ' + JSON.stringify({
171 171
             isIOS: Utils.isIOS(),
172 172
             isWebKit: Utils.isWebKit(),
173 173
             renderer: Speedy.Platform.renderer,
174 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 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
 }

Ładowanie…
Anuluj
Zapisz