From 619a8888ebe08de9956f60c16703fb3543aeacc4 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Mon, 13 Jul 2020 07:24:57 -0400 Subject: [PATCH] Added logger assert methods. --- packages/logger/src.ts/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/logger/src.ts/index.ts b/packages/logger/src.ts/index.ts index 128ce00445..d6f3d88ee9 100644 --- a/packages/logger/src.ts/index.ts +++ b/packages/logger/src.ts/index.ts @@ -224,6 +224,16 @@ export class Logger { }); } + assert(condition: any, message: string, code?: ErrorCode, params?: any): void { + if (!!condition) { return; } + this.throwError(message, code, params); + } + + assertArgument(condition: any, message: string, name: string, value: any): void { + if (!!condition) { return; } + this.throwArgumentError(message, name, value); + } + checkNormalize(message?: string): void { if (message == null) { message = "platform missing String.prototype.normalize"; } if (_normalizeError) {