From b9c2a38d7a4da4ae71897fe92559978820e17e02 Mon Sep 17 00:00:00 2001 From: pamapa Date: Tue, 15 Mar 2022 16:53:33 +0100 Subject: [PATCH] fix: ensure we only throw something of type Error --- docs/oidc-client-ts.api.md | 2 +- src/SessionMonitor.ts | 2 +- src/utils/Logger.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/oidc-client-ts.api.md b/docs/oidc-client-ts.api.md index 150e770c3..d09915984 100644 --- a/docs/oidc-client-ts.api.md +++ b/docs/oidc-client-ts.api.md @@ -218,7 +218,7 @@ export class Logger { // (undocumented) static info(name: string, ...args: unknown[]): void; // (undocumented) - throw(err: unknown): never; + throw(err: Error): never; // (undocumented) warn(...args: unknown[]): void; // (undocumented) diff --git a/src/SessionMonitor.ts b/src/SessionMonitor.ts index f513754e9..53f288a8a 100644 --- a/src/SessionMonitor.ts +++ b/src/SessionMonitor.ts @@ -18,7 +18,7 @@ export class SessionMonitor { public constructor(private readonly _userManager: UserManager) { if (!_userManager) { - this._logger.throw("No user manager passed to SessionMonitor"); + this._logger.throw(new Error("No user manager passed")); } this._userManager.events.addUserLoaded(this._start); diff --git a/src/utils/Logger.ts b/src/utils/Logger.ts index c28364fd3..a64d325a5 100644 --- a/src/utils/Logger.ts +++ b/src/utils/Logger.ts @@ -89,7 +89,7 @@ export class Logger { } } - public throw(err: unknown): never { + public throw(err: Error): never { this.error(err); throw err; }