1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 13:23:34 +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:
Oscar Hinton
2024-10-31 10:07:55 +01:00
committed by GitHub
parent 4de7cb8012
commit 5e157c5bca
7 changed files with 38 additions and 21 deletions

View File

@@ -29,5 +29,5 @@ export abstract class SdkService {
*/
abstract userClient$(userId: UserId): Observable<BitwardenClient>;
abstract failedToInitialize(): Promise<void>;
abstract failedToInitialize(category: string, error?: Error): Promise<void>;
}

View File

@@ -130,7 +130,7 @@ export class DefaultSdkService implements SdkService {
return client$;
}
async failedToInitialize(): Promise<void> {
async failedToInitialize(category: string, error?: Error): Promise<void> {
// Only log on cloud instances
if (
this.platformUtilsService.isDev() ||
@@ -139,9 +139,20 @@ export class DefaultSdkService implements SdkService {
return;
}
return this.apiService.send("POST", "/wasm-debug", null, false, false, null, (headers) => {
headers.append("SDK-Version", "1.0.0");
});
return this.apiService.send(
"POST",
"/wasm-debug",
{
category: category,
error: error?.message,
},
false,
false,
null,
(headers) => {
headers.append("SDK-Version", "1.0.0");
},
);
}
private async initializeClient(