diff options
Diffstat (limited to 'Timeline/ClientApp/src/app/utilities/language-untilities.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/utilities/language-untilities.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Timeline/ClientApp/src/app/utilities/language-untilities.ts b/Timeline/ClientApp/src/app/utilities/language-untilities.ts index be9df2dc..7f38f3e4 100644 --- a/Timeline/ClientApp/src/app/utilities/language-untilities.ts +++ b/Timeline/ClientApp/src/app/utilities/language-untilities.ts @@ -3,9 +3,9 @@ export function nullIfUndefined<T>(value: T | undefined): T | null { } export function throwIfNullOrUndefined<T>(value: T | null | undefined, - lazyMessage: () => string = () => 'Value mustn\'t be falsy'): T | never { + message: string | (() => string) = 'Value mustn\'t be null or undefined'): T | never { if (value === null || value === undefined) { - throw new Error(lazyMessage()); + throw new Error(typeof message === 'string' ? message : message()); } else { return value; } |