Small Basic - How to read error messages
Published Feb 12 2019 03:20 PM 3,664 Views
Microsoft
First published on MSDN on Aug 05, 2014

Authored by Ed Price


Today's blog post comes from a section of the longer TechNet Wiki article:


Small Basic: How to Debug by Nonki Takahashi



Meaning of Error Messages


There are two types of error messages given by Small Basic.  One is compile errors.  Another one is runtime errors.  These messages help your development.


Compile errors appear under source code just after "Run" button is clicked if your program has any syntax errors.  The following picture shows errors of a program "Fifty" (BRQ733) :


Sorry, we found some errors...
11,28: The variable 'files' is used, but its value is not assigned.  Are you sure you have spelled it correctly?
29,24: The variable 'buf' is used, but its value is not assigned.  Are you sure you have spelled it correctly?



Numbers mean lines and columns of source code, and you can jump into the point in source program by double clicking the error message.  These kind of compile error messages show you what happened and some advice to fix them. In this case, errors happened because lines with File.GetFiles(path) and File.ReadContents(filename) have been automatically commented out by Small Basic server.


On the other hand, a runtime error appears while a program runs but happens to meet trouble which make the program stop.  Following picture is a sample of divsion by 0 error message.


Value was either too large or too small for a Decimal.
at System.Decimal..ctor(Double value)
at System.Decimal.op_Explicit(Double value)
at Microsoft.SmallBasic.Library.Math.Remainder(Primitive dividend, Primitive divisor)
at _SmallBasicProgram._Main()



The list shown in the text box is called stack trace.  This list shows you relations which subroutine calls which subroutine at the error.  In this case, the stack trace shows that main part of the program calls Math.Remainder() and occurs error.



Check out the rest of this article here:



Small Basic: How to Debug by Nonki Takahashi



And special thanks to Nonki for writing up this concept for us!


- Ninja Ed

Version history
Last update:
‎Feb 12 2019 03:20 PM
Updated by: