From 4f6f9237d6dc586e82af2cd11c9c8b5fc96ad1a4 Mon Sep 17 00:00:00 2001 From: Elijah Mooring Date: Wed, 13 Sep 2023 10:03:42 -0700 Subject: [PATCH] fix(safe_unknown): align a couple wrong errors --- safe_unknown.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/safe_unknown.ts b/safe_unknown.ts index 856ed68..bf17375 100644 --- a/safe_unknown.ts +++ b/safe_unknown.ts @@ -69,7 +69,7 @@ export class SafeUnknown { asNull(): null { if (!this.isNull()) { - throw new BadParamsError(`Expected data to be null, but found type ${typeof this.data} at ${this.#contextPath}`) + throw new BadParamsError(`Expected data to be null, but found type ${this.getType()} at ${this.#contextPath}`) } // @ts-ignore check is above @@ -103,7 +103,7 @@ export class SafeUnknown { } asObject(): SafeUnknownObject { - if (!this.isObject()) throw new Error(`Expected data to be an object, but found type ${typeof this.data}`) + if (!this.isObject()) throw new Error(`Expected data to be an object, but found type ${this.getType()}`) // @ts-ignore check is above return new SafeUnknownObject(this.data)