fix : issues #1732

This commit is contained in:
gtoxlili 2023-05-24 21:08:32 +08:00
parent 8874c687d8
commit ed14a0029a

View File

@ -1,7 +1,10 @@
export function prettyObject(msg: any) {
const obj = msg;
if (typeof msg !== "string") {
msg = JSON.stringify(msg, null, " ");
}
const prettyMsg = ["```json", msg, "```"].join("\n");
return prettyMsg;
if (msg === "{}") {
return obj.toString();
}
return ["```json", msg, "```"].join("\n");
}