1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 05:13:29 +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

@@ -20,6 +20,7 @@ import { CollectionService } from 'jslib-common/abstractions/collection.service'
import { EventService } from 'jslib-common/abstractions/event.service';
import { FolderService } from 'jslib-common/abstractions/folder.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 { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { PolicyService } from 'jslib-common/abstractions/policy.service';
@@ -88,7 +89,7 @@ export class AddEditComponent implements OnInit {
protected auditService: AuditService, protected stateService: StateService,
protected userService: UserService, protected collectionService: CollectionService,
protected messagingService: MessagingService, protected eventService: EventService,
protected policyService: PolicyService) {
protected policyService: PolicyService, private logService: LogService) {
this.typeOptions = [
{ name: i18nService.t('typeLogin'), value: CipherType.Login },
{ name: i18nService.t('typeCard'), value: CipherType.Card },
@@ -283,7 +284,9 @@ export class AddEditComponent implements OnInit {
this.onSavedCipher.emit(this.cipher);
this.messagingService.send(this.editMode && !this.cloneMode ? 'editedCipher' : 'addedCipher');
return true;
} catch { }
} catch (e) {
this.logService.error(e);
}
return false;
}
@@ -346,7 +349,9 @@ export class AddEditComponent implements OnInit {
this.i18nService.t(this.cipher.isDeleted ? 'permanentlyDeletedItem' : 'deletedItem'));
this.onDeletedCipher.emit(this.cipher);
this.messagingService.send(this.cipher.isDeleted ? 'permanentlyDeletedCipher' : 'deletedCipher');
} catch { }
} catch (e) {
this.logService.error(e);
}
return true;
}
@@ -369,7 +374,9 @@ export class AddEditComponent implements OnInit {
this.platformUtilsService.showToast('success', null, this.i18nService.t('restoredItem'));
this.onRestoredCipher.emit(this.cipher);
this.messagingService.send('restoredCipher');
} catch { }
} catch (e) {
this.logService.error(e);
}
return true;
}

View File

@@ -10,6 +10,7 @@ import { ApiService } from 'jslib-common/abstractions/api.service';
import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { LogService } from 'jslib-common/abstractions/log.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { UserService } from 'jslib-common/abstractions/user.service';
@@ -38,7 +39,7 @@ export class AttachmentsComponent implements OnInit {
constructor(protected cipherService: CipherService, protected i18nService: I18nService,
protected cryptoService: CryptoService, protected userService: UserService,
protected platformUtilsService: PlatformUtilsService, protected apiService: ApiService,
protected win: Window) { }
protected win: Window, private logService: LogService) { }
async ngOnInit() {
await this.init();
@@ -71,7 +72,9 @@ export class AttachmentsComponent implements OnInit {
this.cipher = await this.cipherDomain.decrypt();
this.platformUtilsService.showToast('success', null, this.i18nService.t('attachmentSaved'));
this.onUploadedAttachment.emit();
} catch { }
} catch (e) {
this.logService.error(e);
}
// reset file input
// ref: https://stackoverflow.com/a/20552042
@@ -100,7 +103,9 @@ export class AttachmentsComponent implements OnInit {
if (i > -1) {
this.cipher.attachments.splice(i, 1);
}
} catch { }
} catch (e) {
this.logService.error(e);
}
this.deletePromises[attachment.id] = null;
this.onDeletedAttachment.emit();
@@ -226,7 +231,9 @@ export class AttachmentsComponent implements OnInit {
a.downloading = false;
});
await this.reuploadPromises[attachment.id];
} catch { }
} catch (e) {
this.logService.error(e);
}
}
protected loadCipher() {

View File

@@ -9,6 +9,7 @@ import {
import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { CollectionService } from 'jslib-common/abstractions/collection.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { LogService } from 'jslib-common/abstractions/log.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { CipherView } from 'jslib-common/models/view/cipherView';
@@ -30,7 +31,7 @@ export class CollectionsComponent implements OnInit {
protected cipherDomain: Cipher;
constructor(protected collectionService: CollectionService, protected platformUtilsService: PlatformUtilsService,
protected i18nService: I18nService, protected cipherService: CipherService) { }
protected i18nService: I18nService, protected cipherService: CipherService, private logService: LogService) { }
async ngOnInit() {
await this.load();
@@ -65,7 +66,9 @@ export class CollectionsComponent implements OnInit {
await this.formPromise;
this.onSavedCollections.emit();
this.platformUtilsService.showToast('success', null, this.i18nService.t('editedItem'));
} catch { }
} catch (e) {
this.logService.error(e);
}
}
protected loadCipher() {

View File

@@ -9,6 +9,7 @@ import { CryptoService } from 'jslib-common/abstractions/crypto.service';
import { EventService } from 'jslib-common/abstractions/event.service';
import { ExportService } from 'jslib-common/abstractions/export.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { LogService } from 'jslib-common/abstractions/log.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { PolicyService } from 'jslib-common/abstractions/policy.service';
@@ -27,7 +28,8 @@ export class ExportComponent implements OnInit {
constructor(protected cryptoService: CryptoService, protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService, protected exportService: ExportService,
protected eventService: EventService, private policyService: PolicyService, protected win: Window) { }
protected eventService: EventService, private policyService: PolicyService, protected win: Window,
private logService: LogService) { }
async ngOnInit() {
await this.checkExportDisabled();
@@ -66,7 +68,9 @@ export class ExportComponent implements OnInit {
this.downloadFile(data);
this.saved();
await this.collectEvent();
} catch { }
} catch (e) {
this.logService.error(e);
}
} else {
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
this.i18nService.t('invalidMasterPassword'));

View File

@@ -8,6 +8,7 @@ import {
import { FolderService } from 'jslib-common/abstractions/folder.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { LogService } from 'jslib-common/abstractions/log.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { FolderView } from 'jslib-common/models/view/folderView';
@@ -25,7 +26,7 @@ export class FolderAddEditComponent implements OnInit {
deletePromise: Promise<any>;
constructor(protected folderService: FolderService, protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService) { }
protected platformUtilsService: PlatformUtilsService, private logService: LogService) { }
async ngOnInit() {
await this.init();
@@ -46,7 +47,9 @@ export class FolderAddEditComponent implements OnInit {
this.i18nService.t(this.editMode ? 'editedFolder' : 'addedFolder'));
this.onSavedFolder.emit(this.folder);
return true;
} catch { }
} catch (e) {
this.logService.error(e);
}
return false;
}
@@ -64,7 +67,9 @@ export class FolderAddEditComponent implements OnInit {
await this.deletePromise;
this.platformUtilsService.showToast('success', null, this.i18nService.t('deletedFolder'));
this.onDeletedFolder.emit(this.folder);
} catch { }
} catch (e) {
this.logService.error(e);
}
return true;
}

View File

@@ -4,6 +4,7 @@ import { PasswordHintRequest } from 'jslib-common/models/request/passwordHintReq
import { ApiService } from 'jslib-common/abstractions/api.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { LogService } from 'jslib-common/abstractions/log.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
export class HintComponent {
@@ -14,7 +15,8 @@ export class HintComponent {
protected onSuccessfulSubmit: () => void;
constructor(protected router: Router, protected i18nService: I18nService,
protected apiService: ApiService, protected platformUtilsService: PlatformUtilsService) { }
protected apiService: ApiService, protected platformUtilsService: PlatformUtilsService,
private logService: LogService) { }
async submit() {
if (this.email == null || this.email === '') {
@@ -37,6 +39,8 @@ export class HintComponent {
} else if (this.router != null) {
this.router.navigate([this.successRoute]);
}
} catch { }
} catch (e) {
this.logService.error(e);
}
}
}

View File

@@ -96,7 +96,9 @@ export class IconComponent implements OnChanges {
try {
this.image = this.iconsUrl + '/' + Utils.getHostname(hostnameUri) + '/icon.png';
this.fallbackImage = 'images/fa-globe.png';
} catch (e) { }
} catch (e) {
// Ignore error since the fallback icon will be shown if image is null.
}
}
} else {
this.image = null;

View File

@@ -5,6 +5,7 @@ import { ApiService } from 'jslib-common/abstractions/api.service';
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
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 { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { StateService } from 'jslib-common/abstractions/state.service';
@@ -47,7 +48,7 @@ export class LockComponent implements OnInit {
protected userService: UserService, protected cryptoService: CryptoService,
protected storageService: StorageService, protected vaultTimeoutService: VaultTimeoutService,
protected environmentService: EnvironmentService, protected stateService: StateService,
protected apiService: ApiService) { }
protected apiService: ApiService, private logService: LogService) { }
async ngOnInit() {
this.pinSet = await this.vaultTimeoutService.isPinLockSet();
@@ -129,7 +130,9 @@ export class LockComponent implements OnInit {
const localKeyHash = await this.cryptoService.hashPassword(this.masterPassword, key,
HashPurpose.LocalAuthorization);
await this.cryptoService.setKeyHash(localKeyHash);
} catch { }
} catch (e) {
this.logService.error(e);
}
}
if (passwordValid) {

View File

@@ -12,6 +12,7 @@ import { AuthService } from 'jslib-common/abstractions/auth.service';
import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service';
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 { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { StateService } from 'jslib-common/abstractions/state.service';
@@ -49,7 +50,8 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
platformUtilsService: PlatformUtilsService, i18nService: I18nService,
protected stateService: StateService, environmentService: EnvironmentService,
protected passwordGenerationService: PasswordGenerationService,
protected cryptoFunctionService: CryptoFunctionService, private storageService: StorageService) {
protected cryptoFunctionService: CryptoFunctionService, private storageService: StorageService,
protected logService: LogService) {
super(environmentService, i18nService, platformUtilsService);
}
@@ -123,7 +125,9 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
this.router.navigate([this.successRoute]);
}
}
} catch { }
} catch (e) {
this.logService.error(e);
}
}
togglePassword() {

View File

@@ -2,8 +2,8 @@ import { Directive, OnInit } from '@angular/core';
import { ApiService } from 'jslib-common/abstractions/api.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { LogService } from 'jslib-common/abstractions/log.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { TokenService } from 'jslib-common/abstractions/token.service';
import { UserService } from 'jslib-common/abstractions/user.service';
@Directive()
@@ -13,7 +13,7 @@ export class PremiumComponent implements OnInit {
refreshPromise: Promise<any>;
constructor(protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
protected apiService: ApiService, protected userService: UserService) { }
protected apiService: ApiService, protected userService: UserService, private logService: LogService) { }
async ngOnInit() {
this.isPremium = await this.userService.canAccessPremium();
@@ -25,7 +25,9 @@ export class PremiumComponent implements OnInit {
await this.refreshPromise;
this.platformUtilsService.showToast('success', null, this.i18nService.t('refreshComplete'));
this.isPremium = await this.userService.canAccessPremium();
} catch { }
} catch (e) {
this.logService.error(e);
}
}
async purchase() {

View File

@@ -10,6 +10,7 @@ import { AuthService } from 'jslib-common/abstractions/auth.service';
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
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 { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { StateService } from 'jslib-common/abstractions/state.service';
@@ -39,7 +40,8 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
i18nService: I18nService, protected cryptoService: CryptoService,
protected apiService: ApiService, protected stateService: StateService,
platformUtilsService: PlatformUtilsService,
protected passwordGenerationService: PasswordGenerationService, environmentService: EnvironmentService) {
protected passwordGenerationService: PasswordGenerationService, environmentService: EnvironmentService,
protected logService: LogService) {
super(environmentService, i18nService, platformUtilsService);
this.showTerms = !platformUtilsService.isSelfHost();
}
@@ -158,7 +160,9 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
}
this.platformUtilsService.showToast('success', null, this.i18nService.t('newAccountCreated'));
this.router.navigate([this.successRoute], { queryParams: { email: this.email } });
} catch { }
} catch (e) {
this.logService.error(e);
}
}
togglePassword(confirmField: boolean) {

View File

@@ -12,6 +12,7 @@ import { SendType } from 'jslib-common/enums/sendType';
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 { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { PolicyService } from 'jslib-common/abstractions/policy.service';
@@ -57,7 +58,8 @@ export class AddEditComponent implements OnInit {
constructor(protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
protected environmentService: EnvironmentService, protected datePipe: DatePipe,
protected sendService: SendService, protected userService: UserService,
protected messagingService: MessagingService, protected policyService: PolicyService) {
protected messagingService: MessagingService, protected policyService: PolicyService,
private logService: LogService) {
this.typeOptions = [
{ name: i18nService.t('sendTypeFile'), value: SendType.File },
{ name: i18nService.t('sendTypeText'), value: SendType.Text },
@@ -191,7 +193,9 @@ export class AddEditComponent implements OnInit {
try {
await this.formPromise;
return true;
} catch { }
} catch (e) {
this.logService.error(e);
}
return false;
}
@@ -218,7 +222,9 @@ export class AddEditComponent implements OnInit {
await this.load();
this.onDeletedSend.emit(this.send);
return true;
} catch { }
} catch (e) {
this.logService.error(e);
}
return false;
}

View File

@@ -4,7 +4,6 @@ import {
OnInit,
} from '@angular/core';
import { OrganizationUserStatusType } from 'jslib-common/enums/organizationUserStatusType';
import { PolicyType } from 'jslib-common/enums/policyType';
import { SendType } from 'jslib-common/enums/sendType';
@@ -12,6 +11,7 @@ import { SendView } from 'jslib-common/models/view/sendView';
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 { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { PolicyService } from 'jslib-common/abstractions/policy.service';
import { SearchService } from 'jslib-common/abstractions/search.service';
@@ -48,7 +48,8 @@ export class SendComponent implements OnInit {
constructor(protected sendService: SendService, protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService, protected environmentService: EnvironmentService,
protected ngZone: NgZone, protected searchService: SearchService,
protected policyService: PolicyService, protected userService: UserService) { }
protected policyService: PolicyService, protected userService: UserService,
private logService: LogService) { }
async ngOnInit() {
this.disableSend = await this.policyService.policyAppliesToUser(PolicyType.DisableSend);
@@ -129,7 +130,9 @@ export class SendComponent implements OnInit {
this.platformUtilsService.showToast('success', null, this.i18nService.t('removedPassword'));
await this.load();
}
} catch { }
} catch (e) {
this.logService.error(e);
}
this.actionPromise = null;
}
@@ -156,7 +159,9 @@ export class SendComponent implements OnInit {
this.platformUtilsService.showToast('success', null, this.i18nService.t('deletedSend'));
await this.refresh();
}
} catch { }
} catch (e) {
this.logService.error(e);
}
this.actionPromise = null;
return true;
}

View File

@@ -11,6 +11,7 @@ import { OrganizationUserStatusType } from 'jslib-common/enums/organizationUserS
import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { CollectionService } from 'jslib-common/abstractions/collection.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { LogService } from 'jslib-common/abstractions/log.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { UserService } from 'jslib-common/abstractions/user.service';
@@ -35,7 +36,7 @@ export class ShareComponent implements OnInit {
constructor(protected collectionService: CollectionService, protected platformUtilsService: PlatformUtilsService,
protected i18nService: I18nService, protected userService: UserService,
protected cipherService: CipherService) { }
protected cipherService: CipherService, private logService: LogService) { }
async ngOnInit() {
await this.load();
@@ -88,7 +89,9 @@ export class ShareComponent implements OnInit {
});
await this.formPromise;
return true;
} catch { }
} catch (e) {
this.logService.error(e);
}
return false;
}

View File

@@ -11,6 +11,7 @@ import { AuthService } from 'jslib-common/abstractions/auth.service';
import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service';
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 { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { StateService } from 'jslib-common/abstractions/state.service';
@@ -49,7 +50,7 @@ export class SsoComponent {
protected storageService: StorageService, protected stateService: StateService,
protected platformUtilsService: PlatformUtilsService, protected apiService: ApiService,
protected cryptoFunctionService: CryptoFunctionService, protected environmentService: EnvironmentService,
protected passwordGenerationService: PasswordGenerationService) { }
protected passwordGenerationService: PasswordGenerationService, protected logService: LogService) { }
async ngOnInit() {
this.route.queryParams.pipe(first()).subscribe(async qParams => {
@@ -180,7 +181,9 @@ export class SsoComponent {
this.router.navigate([this.successRoute]);
}
}
} catch { }
} catch (e) {
this.logService.error(e);
}
this.loggingIn = false;
}

View File

@@ -17,6 +17,7 @@ import { ApiService } from 'jslib-common/abstractions/api.service';
import { AuthService } from 'jslib-common/abstractions/auth.service';
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 { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { StateService } from 'jslib-common/abstractions/state.service';
import { StorageService } from 'jslib-common/abstractions/storage.service';
@@ -57,7 +58,8 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
protected i18nService: I18nService, protected apiService: ApiService,
protected platformUtilsService: PlatformUtilsService, protected win: Window,
protected environmentService: EnvironmentService, protected stateService: StateService,
protected storageService: StorageService, protected route: ActivatedRoute) {
protected storageService: StorageService, protected route: ActivatedRoute,
protected logService: LogService) {
this.webAuthnSupported = this.platformUtilsService.supportsWebAuthn(win);
}
@@ -216,7 +218,9 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
this.platformUtilsService.showToast('success', null,
this.i18nService.t('verificationCodeEmailSent', this.twoFactorEmail));
}
} catch { }
} catch (e) {
this.logService.error(e);
}
this.emailPromise = null;
}

View File

@@ -3,6 +3,7 @@ import { Directive } from '@angular/core';
import { ApiService } from 'jslib-common/abstractions/api.service';
import { CryptoService } from 'jslib-common/abstractions/crypto.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 { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
@@ -31,7 +32,7 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
passwordGenerationService: PasswordGenerationService, policyService: PolicyService,
cryptoService: CryptoService, userService: UserService,
messagingService: MessagingService, private apiService: ApiService,
private syncService: SyncService) {
private syncService: SyncService, private logService: LogService) {
super(i18nService, cryptoService, messagingService, userService, passwordGenerationService,
platformUtilsService, policyService);
}
@@ -77,7 +78,9 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
const newEncKey = await this.cryptoService.remakeEncKey(newKey, userEncKey);
await this.performSubmitActions(newPasswordHash, newKey, newEncKey);
} catch { }
} catch (e) {
this.logService.error(e);
}
}
async performSubmitActions(masterPasswordHash: string, key: SymmetricCryptoKey,
@@ -99,6 +102,8 @@ export class UpdateTempPasswordComponent extends BaseChangePasswordComponent {
} else {
this.messagingService.send('logout');
}
} catch { }
} catch (e) {
this.logService.error(e);
}
}
}

View File

@@ -21,6 +21,7 @@ import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
import { EventService } from 'jslib-common/abstractions/event.service';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { LogService } from 'jslib-common/abstractions/log.service';
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { TokenService } from 'jslib-common/abstractions/token.service';
@@ -31,7 +32,6 @@ import { ErrorResponse } from 'jslib-common/models/response/errorResponse';
import { AttachmentView } from 'jslib-common/models/view/attachmentView';
import { CipherView } from 'jslib-common/models/view/cipherView';
import { FieldView } from 'jslib-common/models/view/fieldView';
import { LoginUriView } from 'jslib-common/models/view/loginUriView';
const BroadcasterSubscriptionId = 'ViewComponent';
@@ -69,7 +69,7 @@ export class ViewComponent implements OnDestroy, OnInit {
protected broadcasterService: BroadcasterService, protected ngZone: NgZone,
protected changeDetectorRef: ChangeDetectorRef, protected userService: UserService,
protected eventService: EventService, protected apiService: ApiService,
protected passwordRepromptService: PasswordRepromptService) { }
protected passwordRepromptService: PasswordRepromptService, private logService: LogService) { }
ngOnInit() {
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
@@ -159,7 +159,9 @@ export class ViewComponent implements OnDestroy, OnInit {
this.platformUtilsService.showToast('success', null,
this.i18nService.t(this.cipher.isDeleted ? 'permanentlyDeletedItem' : 'deletedItem'));
this.onDeletedCipher.emit(this.cipher);
} catch { }
} catch (e) {
this.logService.error(e);
}
return true;
}
@@ -180,7 +182,9 @@ export class ViewComponent implements OnDestroy, OnInit {
await this.restoreCipher();
this.platformUtilsService.showToast('success', null, this.i18nService.t('restoredItem'));
this.onRestoredCipher.emit(this.cipher);
} catch { }
} catch (e) {
this.logService.error(e);
}
return true;
}