mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
[PM-14180] Provide more debugging details in wasm-debug (#11771)
Improve error logging to include some additional information about the error.
This commit is contained in:
@@ -1347,14 +1347,17 @@ export default class MainBackground {
|
||||
if (flagEnabled("sdk")) {
|
||||
// Warn if the SDK for some reason can't be initialized
|
||||
let supported = false;
|
||||
let error: Error;
|
||||
try {
|
||||
supported = await firstValueFrom(this.sdkService.supported$);
|
||||
} catch (e) {
|
||||
// Do nothing.
|
||||
error = e;
|
||||
}
|
||||
|
||||
if (!supported) {
|
||||
this.sdkService.failedToInitialize().catch((e) => this.logService.error(e));
|
||||
this.sdkService
|
||||
.failedToInitialize("background", error)
|
||||
.catch((e) => this.logService.error(e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ChangeDetectorRef, Component, NgZone, OnDestroy, OnInit, inject } from "@angular/core";
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
import { NavigationEnd, Router, RouterOutlet } from "@angular/router";
|
||||
import { Subject, takeUntil, firstValueFrom, concatMap, filter, tap, catchError, of } from "rxjs";
|
||||
import { Subject, takeUntil, firstValueFrom, concatMap, filter, tap } from "rxjs";
|
||||
|
||||
import { LogoutReason } from "@bitwarden/auth/common";
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
@@ -71,21 +71,24 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
) {
|
||||
if (flagEnabled("sdk")) {
|
||||
// Warn if the SDK for some reason can't be initialized
|
||||
this.sdkService.supported$
|
||||
.pipe(
|
||||
takeUntilDestroyed(),
|
||||
catchError(() => {
|
||||
return of(false);
|
||||
}),
|
||||
)
|
||||
.subscribe((supported) => {
|
||||
this.sdkService.supported$.pipe(takeUntilDestroyed()).subscribe({
|
||||
next: (supported) => {
|
||||
if (!supported) {
|
||||
this.logService.debug("SDK is not supported");
|
||||
this.sdkService.failedToInitialize().catch((e) => this.logService.error(e));
|
||||
this.sdkService
|
||||
.failedToInitialize("popup", undefined)
|
||||
.catch((e) => this.logService.error(e));
|
||||
} else {
|
||||
this.logService.debug("SDK is supported");
|
||||
}
|
||||
});
|
||||
},
|
||||
error: (e: unknown) => {
|
||||
this.sdkService
|
||||
.failedToInitialize("popup", e as Error)
|
||||
.catch((e) => this.logService.error(e));
|
||||
this.logService.error(e);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -872,7 +872,7 @@ export class ServiceContainer {
|
||||
}
|
||||
|
||||
if (!supported) {
|
||||
this.sdkService.failedToInitialize().catch((e) => this.logService.error(e));
|
||||
this.sdkService.failedToInitialize("cli").catch((e) => this.logService.error(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
.subscribe((supported) => {
|
||||
if (!supported) {
|
||||
this.logService.debug("SDK is not supported");
|
||||
this.sdkService.failedToInitialize().catch((e) => this.logService.error(e));
|
||||
this.sdkService.failedToInitialize("desktop").catch((e) => this.logService.error(e));
|
||||
} else {
|
||||
this.logService.debug("SDK is supported");
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
.subscribe((supported) => {
|
||||
if (!supported) {
|
||||
this.logService.debug("SDK is not supported");
|
||||
this.sdkService.failedToInitialize().catch((e) => this.logService.error(e));
|
||||
this.sdkService.failedToInitialize("web").catch((e) => this.logService.error(e));
|
||||
} else {
|
||||
this.logService.debug("SDK is supported");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user