If not string, stringify it

This commit is contained in:
Valtteri Karesto
2022-06-17 13:42:19 +03:00
parent 742b11374f
commit eda8b1550c

View File

@@ -79,7 +79,7 @@ const RunScript: React.FC<{ file: IFile }> = ({ file }) => {
if (e.data.type === "log" || e.data.type === "error") {
const data: ILog[] = e.data.args.map((msg: any) => ({
type: e.data.type,
message: msg.toString(),
message: typeof msg === "string" ? msg : JSON.stringify(msg, null, 2),
}));
state.scriptLogs = [...snap.scriptLogs, ...data];
}