Explorer: Fix misleading success log in explorer program instruction logs (#29735)

Fix indentation and avoid truncation of logs
This commit is contained in:
nvsriram 2023-01-17 11:23:52 -05:00 committed by GitHub
parent 1d88654116
commit 3d62139a3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -95,10 +95,18 @@ export function parseProgramLogs(
} else if (log.includes("failed")) {
const instructionLog = prettyLogs[prettyLogs.length - 1];
instructionLog.failed = true;
let currText =`Program returned error: "${log.slice(log.indexOf(": ") + 2)}"`;
// failed to verify log of previous program so reset depth and print full log
if (log.startsWith("failed")) {
depth++;
currText = log.charAt(0).toUpperCase() + log.slice(1);
}
instructionLog.logs.push({
prefix: prefixBuilder(depth),
style: "warning",
text: `Program returned error: "${log.slice(log.indexOf(": ") + 2)}"`,
text: currText
});
depth--;
} else {
@ -127,7 +135,7 @@ export function parseProgramLogs(
return `Program consumed: ${p1} ${p2}`;
}
);
// native program logs don't start with "Program log:"
prettyLogs[prettyLogs.length - 1].logs.push({
prefix: prefixBuilder(depth),