From 9908f4aaa5d172fc93e1a8ef71d69d8739d6a73d Mon Sep 17 00:00:00 2001 From: omuretsu <84951833+Snarling@users.noreply.github.com> Date: Fri, 14 Oct 2022 11:08:24 -0400 Subject: [PATCH] Error message fixes --- src/NetscriptFunctions.ts | 4 ++-- src/utils/helpers/typeAssertion.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 7066f75b6..7d0b175fd 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -1758,11 +1758,11 @@ const base: InternalAPI = { _options ??= options; const txt = helpers.string(ctx, "txt", _txt); assert(_options, objectAssert, (type) => - helpers.makeRuntimeErrorMsg(ctx, `Invalid type for options: ${type}, should be object.`, "TYPE"), + helpers.makeRuntimeErrorMsg(ctx, `Invalid type for options: ${type}. Should be object.`, "TYPE"), ); if (_options.type !== undefined) { assert(_options.type, stringAssert, (type) => - helpers.makeRuntimeErrorMsg(ctx, `Invalid type for options.type: ${type}, should be string.`, "TYPE"), + helpers.makeRuntimeErrorMsg(ctx, `Invalid type for options.type: ${type}. Should be string.`, "TYPE"), ); options.type = _options.type; const validTypes = ["boolean", "text", "select"]; diff --git a/src/utils/helpers/typeAssertion.ts b/src/utils/helpers/typeAssertion.ts index d5736b857..5f0f3e66e 100644 --- a/src/utils/helpers/typeAssertion.ts +++ b/src/utils/helpers/typeAssertion.ts @@ -12,7 +12,7 @@ export function assert( try { assertFn(v); } catch (type: unknown) { - if (type !== "string") type = "unknown"; + if (typeof type !== "string") type = "unknown"; throw msgFn(type as string); } }