Skip to content

Commit

Permalink
Use ValidationService to handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
alec-livefront committed Dec 20, 2024
1 parent 0932e18 commit 3934101
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { DevicesServiceAbstraction } from "@bitwarden/common/auth/abstractions/d
import { DeviceView } from "@bitwarden/common/auth/abstractions/devices/views/device.view";
import { DeviceType, DeviceTypeMetadata } from "@bitwarden/common/enums";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { ValidationService } from "@bitwarden/common/platform/abstractions/validation.service";
import { DialogService, ToastService, TableDataSource, TableModule } from "@bitwarden/components";

Check warning on line 12 in apps/web/src/app/auth/settings/security/device-management.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/settings/security/device-management.component.ts#L7-L12

Added lines #L7 - L12 were not covered by tests

import { SharedModule } from "../../../shared";

Check warning on line 14 in apps/web/src/app/auth/settings/security/device-management.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/settings/security/device-management.component.ts#L14

Added line #L14 was not covered by tests
Expand Down Expand Up @@ -43,6 +44,7 @@ export class DeviceManagementComponent {
private devicesService: DevicesServiceAbstraction,
private dialogService: DialogService,
private toastService: ToastService,
private validationService: ValidationService,

Check warning on line 47 in apps/web/src/app/auth/settings/security/device-management.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/settings/security/device-management.component.ts#L47

Added line #L47 was not covered by tests
) {
this.devicesService

Check warning on line 49 in apps/web/src/app/auth/settings/security/device-management.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/settings/security/device-management.component.ts#L49

Added line #L49 was not covered by tests
.getCurrentDevice$()
Expand Down Expand Up @@ -202,12 +204,8 @@ export class DeviceManagementComponent {
message: this.i18nService.t("deviceRemoved"),
variant: "success",
});
} catch (e) {
this.toastService.showToast({
title: "",
message: this.i18nService.t("errorOccurred"),
variant: "warning",
});
} catch (error) {
this.validationService.showError(error);

Check warning on line 208 in apps/web/src/app/auth/settings/security/device-management.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/auth/settings/security/device-management.component.ts#L208

Added line #L208 was not covered by tests
}
}
}

0 comments on commit 3934101

Please sign in to comment.