Skip to content

Commit

Permalink
fix(safe_unknown): align a couple wrong errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Vehmloewff committed Sep 13, 2023
1 parent 37bb2fc commit 4f6f923
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions safe_unknown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4f6f923

Please sign in to comment.