diff --git a/plugos/system.ts b/plugos/system.ts index d4ff4bc9..78138f7d 100644 --- a/plugos/system.ts +++ b/plugos/system.ts @@ -81,6 +81,17 @@ export class System extends EventEmitter> { * @param args an array of arguments to pass to the function */ invokeFunction(name: string, args: any[]): Promise { + // Some sanity type checks + if (typeof name !== "string") { + throw new Error( + `invokeFunction: function name should be a string, got ${typeof name}`, + ); + } + if (!Array.isArray(args)) { + throw new Error( + `invokeFunction: args should be an array, got ${typeof args}`, + ); + } const [plugName, functionName] = name.split("."); if (!functionName) { // Sanity check