mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 05:05:47 +01:00
Error message fixes
This commit is contained in:
parent
7683990d17
commit
9908f4aaa5
@ -1758,11 +1758,11 @@ const base: InternalAPI<NS> = {
|
||||
_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"];
|
||||
|
@ -12,7 +12,7 @@ export function assert<T>(
|
||||
try {
|
||||
assertFn(v);
|
||||
} catch (type: unknown) {
|
||||
if (type !== "string") type = "unknown";
|
||||
if (typeof type !== "string") type = "unknown";
|
||||
throw msgFn(type as string);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user