Skip to content

Commit

Permalink
Merge pull request #150 from jaipaljadeja/fix/compile-runtime-error-m…
Browse files Browse the repository at this point in the history
…essages

fix: compile and runtime error messaging
  • Loading branch information
barabanovro authored Apr 15, 2024
2 parents fd4b003 + 76e5cc1 commit b68fec1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions components/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,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

0 comments on commit b68fec1

Please sign in to comment.