1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 09:43:23 +00:00

Remove empty catch blocks and remove allow-empty-catch tslint rule (#2136)

This commit is contained in:
Oscar Hinton
2021-10-21 11:10:46 +02:00
committed by GitHub
parent 6a02487778
commit ce2e6c3cb4
28 changed files with 103 additions and 67 deletions

View File

@@ -184,7 +184,8 @@ export default class MainBackground {
this.settingsService = new SettingsService(this.userService, this.storageService);
this.fileUploadService = new FileUploadService(this.logService, this.apiService);
this.cipherService = new CipherService(this.cryptoService, this.userService, this.settingsService,
this.apiService, this.fileUploadService, this.storageService, this.i18nService, () => this.searchService);
this.apiService, this.fileUploadService, this.storageService, this.i18nService, () => this.searchService,
this.logService);
this.folderService = new FolderService(this.cryptoService, this.userService, this.apiService,
this.storageService, this.i18nService, this.cipherService);
this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService,
@@ -193,7 +194,7 @@ export default class MainBackground {
this.sendService = new SendService(this.cryptoService, this.userService, this.apiService, this.fileUploadService,
this.storageService, this.i18nService, this.cryptoFunctionService);
this.stateService = new StateService();
this.policyService = new PolicyService(this.userService, this.storageService);
this.policyService = new PolicyService(this.userService, this.storageService, this.apiService);
this.vaultTimeoutService = new VaultTimeoutService(this.cipherService, this.folderService,
this.collectionService, this.cryptoService, this.platformUtilsService, this.storageService,
this.messagingService, this.searchService, this.userService, this.tokenService, this.policyService,
@@ -211,14 +212,14 @@ export default class MainBackground {
this.syncService = new SyncService(this.userService, this.apiService, this.settingsService,
this.folderService, this.cipherService, this.cryptoService, this.collectionService,
this.storageService, this.messagingService, this.policyService, this.sendService,
async (expired: boolean) => await this.logout(expired));
this.logService, async (expired: boolean) => await this.logout(expired));
this.eventService = new EventService(this.storageService, this.apiService, this.userService,
this.cipherService);
this.cipherService, this.logService);
this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService,
this.policyService);
this.totpService = new TotpService(this.storageService, this.cryptoFunctionService);
this.totpService = new TotpService(this.storageService, this.cryptoFunctionService, this.logService);
this.autofillService = new AutofillService(this.cipherService, this.userService, this.totpService,
this.eventService);
this.eventService, this.logService);
this.containerService = new ContainerService(this.cryptoService);
this.auditService = new AuditService(this.cryptoFunctionService, this.apiService);
this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService,
@@ -242,7 +243,8 @@ export default class MainBackground {
// Background
this.runtimeBackground = new RuntimeBackground(this, this.autofillService,
this.platformUtilsService as BrowserPlatformUtilsService, this.storageService, this.i18nService,
this.notificationsService, this.systemService, this.environmentService, this.messagingService);
this.notificationsService, this.systemService, this.environmentService, this.messagingService,
this.logService);
this.nativeMessagingBackground = new NativeMessagingBackground(this.storageService, this.cryptoService, this.cryptoFunctionService,
this.vaultTimeoutService, this.runtimeBackground, this.i18nService, this.userService, this.messagingService, this.appIdService,
this.platformUtilsService);
@@ -548,7 +550,9 @@ export default class MainBackground {
this.browserActionSetBadgeText(theText, tabId);
return;
} catch { }
} catch (e) {
this.logService.error(e);
}
}
await this.loadMenuAndUpdateBadgeForNoAccessState(contextMenuEnabled);

View File

@@ -1,4 +1,4 @@
import NotificationQueueMessage from "./notificationQueueMessage";
import NotificationQueueMessage from './notificationQueueMessage';
export default class AddChangePasswordQueueMessage extends NotificationQueueMessage {
cipherId: string;

View File

@@ -1,4 +1,4 @@
import NotificationQueueMessage from "./notificationQueueMessage";
import NotificationQueueMessage from './notificationQueueMessage';
export default class AddLoginQueueMessage extends NotificationQueueMessage {
username: string;

View File

@@ -2,6 +2,6 @@ export default class LockedVaultPendingNotificationsItem {
commandToRetry: {
msg: any;
sender: chrome.runtime.MessageSender;
}
};
target: string;
}

View File

@@ -1,4 +1,4 @@
import { NotificationQueueMessageType } from "./notificationQueueMessageType";
import { NotificationQueueMessageType } from './notificationQueueMessageType';
export default class NotificationQueueMessage {
type: NotificationQueueMessageType;

View File

@@ -1,10 +1,12 @@
import { EnvironmentService } from 'jslib-common/abstractions/environment.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { LogService } from 'jslib-common/abstractions/log.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { NotificationsService } from 'jslib-common/abstractions/notifications.service';
import { StorageService } from 'jslib-common/abstractions/storage.service';
import { SystemService } from 'jslib-common/abstractions/system.service';
import { ConstantsService } from 'jslib-common/services/constants.service';
import { AutofillService } from '../services/abstractions/autofill.service';
import BrowserPlatformUtilsService from '../services/browserPlatformUtils.service';
@@ -25,7 +27,8 @@ export default class RuntimeBackground {
private platformUtilsService: BrowserPlatformUtilsService,
private storageService: StorageService, private i18nService: I18nService,
private notificationsService: NotificationsService, private systemService: SystemService,
private environmentService: EnvironmentService, private messagingService: MessagingService) {
private environmentService: EnvironmentService, private messagingService: MessagingService,
private logService: LogService) {
// onInstalled listener must be wired up before anything else, so we do it in the ctor
chrome.runtime.onInstalled.addListener((details: any) => {
@@ -137,7 +140,9 @@ export default class RuntimeBackground {
BrowserApi.createNewTab('popup/index.html?uilocation=popout#/sso?code=' +
msg.code + '&state=' + msg.state);
}
catch { }
catch {
this.logService.error('Unable to open sso popout tab');
}
break;
case 'webAuthnResult':
const vaultUrl2 = this.environmentService.getWebVaultUrl();