RFO-BASIC / Basic

The Repository for the files the Basic project that creates the BASIC! APK for Google Play
62 stars 42 forks source link

Very messy error with Read.Next command #223

Closed mougino closed 7 years ago

mougino commented 8 years ago

User QBFan reported here that the following command: read.data 0:read.next b$ throws a very messy error:

Internal error! Please notify developer. java.security.InvalidParameterException: wrong type for this variable. at com.rfo.basic.Var$NumVal.sval(Var.java:146) at.com.rfo.basic.Run$Interpreter.executeREAD_NEXT(Run.java:8224) ... (9 more lines) Invalid parameter exception, near line: read.nextb$

I think we could go without the stack trace.

jMarcS commented 7 years ago

The nval() and sval() methods of all of the Var subclasses throw an InvalidParameterException on a type mismatch. The message is "Wrong type for this variable." In executeREAD_NEXT(), I can wrap the variable value lookup in a try/catch, and set the catch block to call RunTimeError that displays the "Wrong type..." message. Good enough?

jMarcS commented 7 years ago

Released in Version 01.91, 2017/03/14.