Skip to content

Commit c86a616

Browse files
committed
fix: show simulation error when RPC returns empty logs
1 parent daf48dd commit c86a616

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/features/instruction-simulation/ui/SimulationCard.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,21 @@ export function SimulatorCard({ message, showTokenBalanceChanges, accountBalance
7575

7676
const { logs, solBalanceChanges, epoch, unitsConsumed, error } = simulation.result;
7777
const succeeded = !error;
78+
const hasLogs = !!logs?.length;
79+
const hasErrorWithoutLogs = !hasLogs && !!error;
7880

7981
return (
8082
<>
8183
<SimulationCardShell action={<SimulateButton label="Retry" onClick={simulation.simulate} />}>
82-
{logs && <ProgramLogsCardBody message={message} logs={logs} cluster={cluster} url={url} />}
84+
{hasLogs && <ProgramLogsCardBody message={message} logs={logs} cluster={cluster} url={url} />}
85+
{hasErrorWithoutLogs && (
86+
<div className="card-body">
87+
<div>
88+
Simulation Failure:
89+
<span className="e-ml-2 e-text-yellow-500">{error}</span>
90+
</div>
91+
</div>
92+
)}
8393
</SimulationCardShell>
8494
{logs && (
8595
<SimulatorCUProfilingCard

0 commit comments

Comments
 (0)