mirror of
https://github.com/bitwarden/browser
synced 2025-12-31 07:33:23 +00:00
Remove empty catch blocks, and update tslint rule (#513)
This commit is contained in:
@@ -185,7 +185,9 @@ class Version {
|
||||
this.year = parts[0];
|
||||
this.month = parts[1];
|
||||
this.day = parts[2];
|
||||
} catch { }
|
||||
} catch {
|
||||
// Ignore error
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Compares two Azure Versions against each other
|
||||
|
||||
@@ -51,6 +51,7 @@ import { UserService } from '../abstractions/user.service';
|
||||
|
||||
import { ConstantsService } from './constants.service';
|
||||
|
||||
import { LogService } from '../abstractions/log.service';
|
||||
import { sequentialize } from '../misc/sequentialize';
|
||||
import { Utils } from '../misc/utils';
|
||||
|
||||
@@ -73,7 +74,8 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
constructor(private cryptoService: CryptoService, private userService: UserService,
|
||||
private settingsService: SettingsService, private apiService: ApiService,
|
||||
private fileUploadService: FileUploadService, private storageService: StorageService,
|
||||
private i18nService: I18nService, private searchService: () => SearchService) {
|
||||
private i18nService: I18nService, private searchService: () => SearchService,
|
||||
private logService: LogService) {
|
||||
}
|
||||
|
||||
get decryptedCipherCache() {
|
||||
@@ -423,7 +425,9 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
if (regex.test(url)) {
|
||||
return true;
|
||||
}
|
||||
} catch { }
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
break;
|
||||
case UriMatchType.Never:
|
||||
default:
|
||||
|
||||
@@ -564,7 +564,9 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
try {
|
||||
encType = parseInt(headerPieces[0], null);
|
||||
encPieces = headerPieces[1].split('|');
|
||||
} catch (e) { }
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
switch (encType) {
|
||||
|
||||
@@ -10,13 +10,15 @@ import { EventService as EventServiceAbstraction } from '../abstractions/event.s
|
||||
import { StorageService } from '../abstractions/storage.service';
|
||||
import { UserService } from '../abstractions/user.service';
|
||||
|
||||
import { LogService } from '../abstractions/log.service';
|
||||
import { ConstantsService } from './constants.service';
|
||||
|
||||
export class EventService implements EventServiceAbstraction {
|
||||
private inited = false;
|
||||
|
||||
constructor(private storageService: StorageService, private apiService: ApiService,
|
||||
private userService: UserService, private cipherService: CipherService) { }
|
||||
private userService: UserService, private cipherService: CipherService,
|
||||
private logService: LogService) { }
|
||||
|
||||
init(checkOnInterval: boolean) {
|
||||
if (this.inited) {
|
||||
@@ -83,7 +85,9 @@ export class EventService implements EventServiceAbstraction {
|
||||
try {
|
||||
await this.apiService.postEventsCollect(request);
|
||||
this.clearEvents();
|
||||
} catch { }
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
async clearEvents(): Promise<any> {
|
||||
|
||||
@@ -192,7 +192,9 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
||||
if (sync) {
|
||||
await this.syncService.fullSync(false);
|
||||
}
|
||||
} catch { }
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
|
||||
if (!this.connected) {
|
||||
this.reconnectTimer = setTimeout(() => this.reconnect(sync), this.random(120000, 300000));
|
||||
|
||||
@@ -125,7 +125,9 @@ export class SearchService implements SearchServiceAbstraction {
|
||||
if (isQueryString) {
|
||||
try {
|
||||
searchResults = index.search(query.substr(1).trim());
|
||||
} catch { }
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
} else {
|
||||
// tslint:disable-next-line
|
||||
const soWild = lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { CipherService } from '../abstractions/cipher.service';
|
||||
import { CollectionService } from '../abstractions/collection.service';
|
||||
import { CryptoService } from '../abstractions/crypto.service';
|
||||
import { FolderService } from '../abstractions/folder.service';
|
||||
import { LogService } from '../abstractions/log.service';
|
||||
import { MessagingService } from '../abstractions/messaging.service';
|
||||
import { PolicyService } from '../abstractions/policy.service';
|
||||
import { SendService } from '../abstractions/send.service';
|
||||
@@ -44,7 +45,8 @@ export class SyncService implements SyncServiceAbstraction {
|
||||
private cipherService: CipherService, private cryptoService: CryptoService,
|
||||
private collectionService: CollectionService, private storageService: StorageService,
|
||||
private messagingService: MessagingService, private policyService: PolicyService,
|
||||
private sendService: SendService, private logoutCallback: (expired: boolean) => Promise<void>) {
|
||||
private sendService: SendService, private logService: LogService,
|
||||
private logoutCallback: (expired: boolean) => Promise<void>) {
|
||||
}
|
||||
|
||||
async getLastSync(): Promise<Date> {
|
||||
@@ -131,7 +133,9 @@ export class SyncService implements SyncServiceAbstraction {
|
||||
return this.syncCompleted(true);
|
||||
}
|
||||
}
|
||||
} catch { }
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
}
|
||||
return this.syncCompleted(false);
|
||||
}
|
||||
@@ -230,7 +234,9 @@ export class SyncService implements SyncServiceAbstraction {
|
||||
return this.syncCompleted(true);
|
||||
}
|
||||
}
|
||||
} catch { }
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
}
|
||||
return this.syncCompleted(false);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ConstantsService } from './constants.service';
|
||||
|
||||
import { CryptoFunctionService } from '../abstractions/cryptoFunction.service';
|
||||
import { LogService } from '../abstractions/log.service';
|
||||
import { StorageService } from '../abstractions/storage.service';
|
||||
import { TotpService as TotpServiceAbstraction } from '../abstractions/totp.service';
|
||||
|
||||
@@ -10,7 +11,8 @@ const B32Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||
const SteamChars = '23456789BCDFGHJKMNPQRTVWXY';
|
||||
|
||||
export class TotpService implements TotpServiceAbstraction {
|
||||
constructor(private storageService: StorageService, private cryptoFunctionService: CryptoFunctionService) { }
|
||||
constructor(private storageService: StorageService, private cryptoFunctionService: CryptoFunctionService,
|
||||
private logService: LogService) { }
|
||||
|
||||
async getCode(key: string): Promise<string> {
|
||||
if (key == null) {
|
||||
@@ -32,7 +34,9 @@ export class TotpService implements TotpServiceAbstraction {
|
||||
} else if (digitParams > 0) {
|
||||
digits = digitParams;
|
||||
}
|
||||
} catch { }
|
||||
} catch {
|
||||
this.logService.error('Invalid digits param.');
|
||||
}
|
||||
}
|
||||
if (params.has('period') && params.get('period') != null) {
|
||||
try {
|
||||
@@ -40,7 +44,9 @@ export class TotpService implements TotpServiceAbstraction {
|
||||
if (periodParam > 0) {
|
||||
period = periodParam;
|
||||
}
|
||||
} catch { }
|
||||
} catch {
|
||||
this.logService.error('Invalid period param.');
|
||||
}
|
||||
}
|
||||
if (params.has('secret') && params.get('secret') != null) {
|
||||
keyB32 = params.get('secret');
|
||||
@@ -99,7 +105,9 @@ export class TotpService implements TotpServiceAbstraction {
|
||||
if (params.has('period') && params.get('period') != null) {
|
||||
try {
|
||||
period = parseInt(params.get('period').trim(), null);
|
||||
} catch { }
|
||||
} catch {
|
||||
this.logService.error('Invalid period param.');
|
||||
}
|
||||
}
|
||||
}
|
||||
return period;
|
||||
|
||||
Reference in New Issue
Block a user