code fails silently
ianatha opened this issue · 2 comments
ianatha commented
The following code fails silently:
10 REM 29-10-2023
20 DIM A(2)
30 A(0)=6:A(1)=A(0)+11
35 A(2)=A(1)+10
40 FOR I%=1 TO 2
50 PRINT "A(",I%,")=",A(I%)
60 NEXT I%
The output was:
REM --- OUTPUT START
REM --- OUTPUT END
ianatha commented
From logcat:
2023-10-29 22:22:20.910 5018-5018 INFO io.atha.quickbasic I Running script: 10 REM 29-10-2023
20 DIM A(2)
30 A(0)=6:A(1)=A(0)+11
35 A(2)=A(1)+10
40 FOR I%=1 TO 2
50 PRINT "A(",I%,")=",A(I%)
60 NEXT I%
2023-10-29 22:22:21.210 5018-5018 System.err io.atha.quickbasic W org.puffinbasic.error.PuffinBasicRuntimeError: [ARRAY_INDEX_OUT_OF_BOUNDS] Index 2 is out of range for dimension[0]=2
2023-10-29 22:22:21.210 5018-5018 System.err io.atha.quickbasic W Line: [editor.bas:35(56-59)]
2023-10-29 22:22:21.210 5018-5018 System.err io.atha.quickbasic W A(2)
2023-10-29 22:22:21.210 5018-5018 System.err io.atha.quickbasic W at org.puffinbasic.runtime.PuffinBasicRuntime.run(PuffinBasicRuntime.java:117)
2023-10-29 22:22:21.210 5018-5018 System.err io.atha.quickbasic W at org.puffinbasic.PuffinBasicInterpreterMain.run(PuffinBasicInterpreterMain.java:195)
2023-10-29 22:22:21.210 5018-5018 System.err io.atha.quickbasic W at org.puffinbasic.PuffinBasicInterpreterMain.interpretAndRun(PuffinBasicInterpreterMain.java:176)
2023-10-29 22:22:21.210 5018-5018 System.err io.atha.quickbasic W at io.atha.quickbasic.MainActivity.onOptionsItemSelected(MainActivity.kt:595)
ianatha commented
The fix here is surfacing the PuffinBasicRuntimeError
to the UI and displaying it.