1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 21:33:27 +00:00

Remove empty catch blocks, and update tslint rule (#513)

This commit is contained in:
Oscar Hinton
2021-10-19 10:32:14 +02:00
committed by GitHub
parent 62011628d0
commit f09fb69882
38 changed files with 228 additions and 85 deletions

View File

@@ -6,6 +6,7 @@ import { WindowMain } from './window.main';
import { BiometricMain } from 'jslib-common/abstractions/biometric.main';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { LogService } from 'jslib-common/abstractions/log.service';
import { StorageService } from 'jslib-common/abstractions/storage.service';
import { ConstantsService } from 'jslib-common/services/constants.service';
@@ -14,7 +15,8 @@ export default class BiometricWindowsMain implements BiometricMain {
private windowsSecurityCredentialsUiModule: any;
constructor(private storageService: StorageService, private i18nservice: I18nService, private windowMain: WindowMain) { }
constructor(private storageService: StorageService, private i18nservice: I18nService, private windowMain: WindowMain,
private logService: LogService) { }
async init() {
this.windowsSecurityCredentialsUiModule = this.getWindowsSecurityCredentialsUiModule();
@@ -125,8 +127,9 @@ export default class BiometricWindowsMain implements BiometricMain {
try {
const version = require('os').release();
return Number.parseInt(version.split('.')[0], 10);
} catch {
this.logService.error('Unable to resolve windows major version number');
}
catch { }
return -1;
}
}

View File

@@ -1,13 +1,21 @@
import { app, BrowserWindow, screen } from 'electron';
import { ElectronConstants } from './electronConstants';
import {
app,
BrowserWindow,
screen,
} from 'electron';
import * as path from 'path';
import * as url from 'url';
import { isDev, isMacAppStore, isSnapStore } from './utils';
import { LogService } from 'jslib-common/abstractions/log.service';
import { StorageService } from 'jslib-common/abstractions/storage.service';
import { ElectronConstants } from './electronConstants';
import {
isDev,
isMacAppStore,
isSnapStore,
} from './utils';
const WindowEventHandlingDelay = 100;
const Keys = {
mainWindowSize: 'mainWindowSize',
@@ -21,8 +29,8 @@ export class WindowMain {
private windowStates: { [key: string]: any; } = {};
private enableAlwaysOnTop: boolean = false;
constructor(private storageService: StorageService, private hideTitleBar = false,
private defaultWidth = 950, private defaultHeight = 600,
constructor(private storageService: StorageService, private logService: LogService,
private hideTitleBar = false, private defaultWidth = 950, private defaultHeight = 600,
private argvCallback: (argv: string[]) => void = null,
private createWindowCallback: (win: BrowserWindow) => void) { }
@@ -224,7 +232,9 @@ export class WindowMain {
}
await this.storageService.save(configKey, this.windowStates[configKey]);
} catch (e) { }
} catch (e) {
this.logService.error(e);
}
}
private async getWindowState(configKey: string, defaultWidth: number, defaultHeight: number) {