Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compile and runtime error messaging #150

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions components/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,17 @@ const Editor = ({ readOnly = false }: Props) => {
if (serializedOutput) {
addToConsoleLog(`Execution output: ${serializedOutput}`)
}

if (executionState === ProgramExecutionState.Error) {
addToConsoleLog(
'Runtime error: ' + executionPanicMessage,
LogType.Error,
)
}
} else if (compilationState === ProgramCompilationState.CompilationErr) {
addToConsoleLog('Compilation failed', LogType.Error)
}

if (executionState === ProgramExecutionState.Error) {
addToConsoleLog('Runtime error: ' + executionPanicMessage, LogType.Error)
}

// Compilation finished, log the API logs, if any
for (const apiLogEntry of apiLogs) {
let log_type
Expand Down
2 changes: 1 addition & 1 deletion components/Tracer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export const Tracer = () => {
</button>
</nav>
</div>
<div className="pane pane-light overflow-auto pb-4 grow h-[90%]">
<div className="pane pane-light overflow-auto pb-4 grow h-[calc(100%_-_38px)]">
{selectedConsoleTab === IConsoleTab.Console && <Console />}

{selectedConsoleTab === IConsoleTab.DebugInfo && (
Expand Down
2 changes: 1 addition & 1 deletion context/cairoVMApiContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export const CairoVMApiProvider: React.FC<PropsWithChildren> = ({
? ProgramCompilationState.CompilationSuccess
: ProgramCompilationState.CompilationErr,
)
setLogs(data.logs)
setExecutionState(
data.is_execution_successful === true
? ProgramExecutionState.Success
Expand All @@ -211,7 +212,6 @@ export const CairoVMApiProvider: React.FC<PropsWithChildren> = ({
setSierraCode(data.sierra_program_code)
setCairoLangCompilerVersion(data.cairo_lang_compiler_version)
setSerializedOutput(data.serialized_output)
setLogs(data.logs)
setExecutionPanicMessage(data.execution_panic_message)
setTracerData({
memory: data.tracer_data.memory,
Expand Down
Loading