mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 07:02:26 +01:00
Error message fixes
This commit is contained in:
parent
7683990d17
commit
9908f4aaa5
@ -1758,11 +1758,11 @@ const base: InternalAPI<NS> = {
|
|||||||
_options ??= options;
|
_options ??= options;
|
||||||
const txt = helpers.string(ctx, "txt", _txt);
|
const txt = helpers.string(ctx, "txt", _txt);
|
||||||
assert(_options, objectAssert, (type) =>
|
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) {
|
if (_options.type !== undefined) {
|
||||||
assert(_options.type, stringAssert, (type) =>
|
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;
|
options.type = _options.type;
|
||||||
const validTypes = ["boolean", "text", "select"];
|
const validTypes = ["boolean", "text", "select"];
|
||||||
|
@ -12,7 +12,7 @@ export function assert<T>(
|
|||||||
try {
|
try {
|
||||||
assertFn(v);
|
assertFn(v);
|
||||||
} catch (type: unknown) {
|
} catch (type: unknown) {
|
||||||
if (type !== "string") type = "unknown";
|
if (typeof type !== "string") type = "unknown";
|
||||||
throw msgFn(type as string);
|
throw msgFn(type as string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user