Skip to main content

Foutcodes

Foutcodes​

Gaat er iets mis terwijl een programma loopt, dan geeft BASIC-256 een fout of een waarschuwing, elk met een eigen nummer. LastError geeft het nummer terug van de laatste die opgevangen werd, en LastErrorMessage de melding ervan. Fouten en waarschuwingen kan je allebei opvangen met Try / Catch / EndTry of OnError. De meldingen zelf blijven in het Engels, want zo toont BASIC-256 ze.

  • Fouten van 1 tot 65535 stoppen het programma, tenzij ze opgevangen worden.
  • Waarschuwingen, vanaf 65536, tonen een melding WARNING en laten het programma verder lopen. Het nummer van een waarschuwing is 65536 plus het nummer van de bijbehorende fout: WARNING_VARNOTASSIGNED is 65536 + 13 = 65549. Op het tabblad Gebruiker van de Voorkeuren kies je of verkeerde typeomzettingen en variabelen zonder waarde genegeerd worden, een waarschuwing geven of een fout geven.
  • Fouten onder 0 zijn vergissingen in het programma zelf, zoals een label of subroutine die ontbreekt, of recursie die te diep gaat. Ook die kan je opvangen, maar je verbetert ze best in het programma.
  • ThrowError geeft een fout met een eigen nummer. Een nummer dat niet in deze tabellen staat, bijvoorbeeld 1000 of meer, heeft de melding "User thrown error number".

In een melding wordt %VARNAME% vervangen door de naam van de variabele. Elke naam in de tabellen is ook een constante die een programma kan gebruiken, bijvoorbeeld if lasterror = error_divzero then, behalve de namen met †, die alleen een nummer hebben.

Voorbeeld​

onerror nicetrap
print 10 / 0
open 99, "bogus.file"
print "Loopt toch verder"
end

nicetrap:
print "fout " + lasterror + " op regel " + lasterrorline + ": " + lasterrormessage
if lasterror = error_divzero then print "(dat was een deling door nul)"
return

toont

fout 50 op regel 2: Division by zero
(dat was een deling door nul)
0.0
fout 5 op regel 3: Invalid File Number
Loopt toch verder

Fouten in het programma zelf​

NummerNaamMelding
-1ERROR_NOSUCHLABELNo such label %VARNAME%
-3ERROR_NOTARRAYVariable %VARNAME% is not an array
-5ERROR_ARGUMENTCOUNTNumber of arguments passed does not match FUNCTION/SUBROUTINE definition
-6ERROR_MAXRECURSEMaximum levels of recursion exceeded
-7ERROR_STACKUNDERFLOWStack Underflow Error
-11ERROR_UNSERIALIZEFORMATUnable to UnSerialize string
-12ERROR_NOSUCHSUBROUTINENo such SUBROUTINE %VARNAME%
-13ERROR_NOSUCHFUNCTIONNo such FUNCTION %VARNAME%
-14ERROR_ONERRORSUBSUBROUTINE %VARNAME% expects arguments and therefore can not be used by ONERROR statement

Fouten​

NummerNaamMelding
5ERROR_FILENUMBERInvalid File Number
6ERROR_FILEOPENUnable to open file
7ERROR_FILENOTOPENFile not open
8ERROR_FILEWRITEUnable to write to file
9ERROR_FILERESETUnable to reset file
10ERROR_ARRAYSIZELARGEArray %VARNAME% dimension too large
11ERROR_ARRAYSIZESMALLArray %VARNAME% dimension too small
12ERROR_ARRAYEVENArray data must be one dimensional with an even number of elements or two dimemsional with two elements in each row
13ERROR_VARNOTASSIGNEDVariable %VARNAME% has not been assigned a value
14ERROR_ARRAYNITEMSArray %VARNAME% rows must have the same number of items
15ERROR_ARRAYINDEXArray %VARNAME% index out of bounds
17ERROR_STRSTARTStarting position less than zero
20ERROR_RGBRGB Color values must be in the range of 0 to 255
23ERROR_POLYPOINTSNot enough points in array for poly()/stamp()
24ERROR_IMAGEFILEUnable to load image file
25ERROR_SPRITENUMBERSprite number out of range
26ERROR_SPRITENASprite has not been assigned
27ERROR_SPRITESLICEUnable to slice image
28ERROR_FOLDERInvalid directory name
29ERROR_INFINITYOperation returned infinity
30ERROR_DBOPENUnable to open SQLITE database
31ERROR_DBQUERYDatabase query error (message follows)
32ERROR_DBNOTOPENDatabase must be opened first
33ERROR_DBCOLNOColumn number out of range or column name not in data set
34ERROR_DBNOTSETRecord set must be opened first
35ERROR_NUMBERCONVUnable to convert to number
36ERROR_NETSOCKError opening network socket
37ERROR_NETHOSTError finding network host
38ERROR_NETCONNUnable to connect to network host
39ERROR_NETREADUnable to read from network connection
40ERROR_NETNONENetwork connection has not been opened
41ERROR_NETWRITEUnable to write to network connection
42ERROR_NETSOCKOPTUnable to set network socket options
43ERROR_NETBINDUnable to bind network socket
44ERROR_NETACCEPTUnable to accept network connection
45ERROR_NETSOCKNUMBERInvalid Socket Number
46ERROR_PERMISSIONYou do not have permission to use this statement/function
47ERROR_IMAGESAVETYPEInvalid image save type
50ERROR_DIVZERODivision by zero
53ERROR_FREEFILEThere are no free file numbers to allocate
54ERROR_FREENETThere are no free network connections to allocate
55ERROR_FREEDBThere are no free database connections to allocate
56ERROR_DBCONNNUMBERInvalid Database Connection Number
57ERROR_FREEDBSETThere are no free data sets to allocate for that database connection
58ERROR_DBSETNUMBERInvalid data set number
59ERROR_DBNOTSETROWYou must advance the data set using DBROW before you can read data from it
60ERROR_PENWIDTHDrawing pen width must be a non-negative number
62ERROR_ARRAYINDEXMISSINGArray variable %VARNAME% has no value without an index
63ERROR_IMAGESCALEImage scale must be greater than or equal to zero
66ERROR_RADIXSTRINGUnable to convert radix string back to a decimal number
67ERROR_RADIXRadix conversion base muse be between 2 and 36
68ERROR_LOGRANGEUnable to calculate the logarithm of a number less than or equal to 0
69ERROR_STRINGMAXLENString exceeds maximum length of 16,777,216 characters
71ERROR_PRINTERNOTONPrinter is not on
72ERROR_PRINTERNOTOFFPrinting is already on
73ERROR_PRINTEROPENUnable to open printer
78ERROR_FILEOPERATIONCan not perform that operation on a Serial Port
79ERROR_SERIALPARAMETERInvalid serial port parameter
80ERROR_LONGRANGENumber exceeds long integer range (minimum to maximum)
81ERROR_INTEGERRANGENumber exceeds integer range (minimum to maximum)
82ERROR_SLICESIZEInvalid Slice dimensions
83ERROR_ARRAYLENGTH2DCan not get a single length of a two dimensional array
84ERROR_EXPECTEDARRAYExpected array
85ERROR_VARNULLVariable %VARNAME% refers to a non-existent variable
86ERROR_VARCIRCULARCircular reference in variable %VARNAME%
87ERROR_IMAGERESOURCESpecified image resource not found
88ERROR_SOUNDRESOURCESpecified sound resource not found
89ERROR_INVALIDRESOURCESpecified resource not found
90ERROR_SOUNDFILEUnable to load sound file
91ERROR_SOUNDNOTSEEKABLE(alleen als waarschuwing gebruikt)
92ERROR_SOUNDLENGTH(alleen als waarschuwing gebruikt)
93ERROR_DOWNLOADError downloading file
94ERROR_EXPECTEDSOUNDExpected sound
95ERROR_TOOMANYSOUNDSToo many sound instances
96ERROR_ENVELOPEODDEnvelope data must contain at least 4 elements and an even number of elements
97ERROR_ENVELOPEMAXIt was exceeded the maximum length of an envelope, which is 20 seconds
98ERROR_HARMONICNUMBERHarmonic number must be an integer greater than zero
99ERROR_HARMONICLISTHarmonics list must be one dimensional array with an even number of elements or two dimemsional array with two elements in each row
100ERROR_WAVOBSOLETE(alleen als waarschuwing gebruikt)
101ERROR_SOUNDFILEFORMAT(alleen als waarschuwing gebruikt)
102ERROR_SOUNDERROR(alleen als waarschuwing gebruikt)
103ERROR_ONEDIMENSIONALExpects one dimensional array or one dimensional list of elements
104ERROR_WAVEFORMLOGICALCreating custom waveform using logical coordinates it request at least 3 elements
105ERROR_STRING2NOTEUnable to convert string to musical note
106ERROR_ARRAYELEMENTElement of array %VARNAME% has not been assigned a value
107ERROR_SETTINGSGETACCESSThe program does not have permission to read settings from other program. Check access level from 'Preferences' panel
108ERROR_SETTINGSSETACCESSThe program does not have permission to write settings for other program. Check access level from 'Preferences' panel
109ERROR_INVALIDPROGNAMEInvalid program name
110ERROR_INVALIDKEYNAMEInvalid key name
111ERROR_SETTINGMAXLENSetting string exceeds maximum length of 16,383 characters
112ERROR_SETTINGMAXKEYSThe maximum number of keys for this program has been exceeded
113ERROR_REFNOTASSIGNEDVariable %VARNAME% refers to an unassigned variable
114ERROR_UNEXPECTEDRETURNUnexpected RETURN
115ERROR_NEXTNOFORNext without FOR
116ERROR_SQRRANGEUnable to calculate the root of a negative number
117ERROR_ASINACOSRANGEUnable to calculate the arc-sine or arc-cosine of a value outside the interval [-1.0, +1.0]
118ERROR_STRINGCONVUnable to convert to a string
119ERROR_BOOLEANCONVUnable to convert to a Boolean
120ERROR_ARRAYEXPRArray Expression Expected.
121ERROR_NUMBEREXPRNumeric Expression Expected.
122ERROR_STRINGEXPRString Expression Expected.
123ERROR_ZEROORONE †Zero or one expected.
124ERROR_NOTMAP †Variable %VARNAME% is not a map
125ERROR_ARRAYORMAPEXPR †Array or Map Expression Expected.
126ERROR_MAPKEY †Map key does not exist
128ERROR_MKDIR †Unable to create new folder
129ERROR_NOTAVAILABLE †Feature not available on this platform
130ERROR_WINDOWSIZE †WINDOW needs a width and a height that are not zero
131ERROR_MATNOTMATRIX †MAT needs an array for %VARNAME%, not a single value
132ERROR_MATDIM †MAT needs both matrices to have the same number of rows and the same number of columns
133ERROR_MATMULDIM †MAT MUL needs the first matrix to have as many columns as the second has rows
134ERROR_MATNOTSQUARE †MAT INV needs a square matrix
135ERROR_MATSINGULAR †MAT INV can not invert a singular matrix
136ERROR_VECNOTVECTOR †DOT, CROSS, NORM and UNIT need an array, not a single value
137ERROR_VECDIM †DOT and CROSS need both vectors to have the same number of elements
138ERROR_CROSSDIM †CROSS needs vectors of two or three elements
139ERROR_VECELEMENT †the vector has an element that has not been given a value
140ERROR_VECZERO †UNIT can not make a unit vector from a vector of length zero
141ERROR_HSV †HSV needs a hue from 0 to 360, and saturation, value and alpha from 0 to 100
65535ERROR_NOTIMPLEMENTEDFeature not implemented in this environment

Waarschuwingen​

NummerNaamMelding
65549WARNING_VARNOTASSIGNEDVariable %VARNAME% has not been assigned a value
65571WARNING_NUMBERCONVUnable to convert string to number, zero used
65616WARNING_LONGRANGENumber exceeds long integer range (minimum to maximum), zero used
65617WARNING_INTEGERRANGENumber exceeds integer range (minimum to maximum), zero used
65627WARNING_SOUNDNOTSEEKABLEMedia file is not seekable
65628WARNING_SOUNDLENGTHDuration is not available for media file
65636WARNING_WAVOBSOLETEWAVPLAY suite is obsolete. Use SOUND/SOUNDPLAY/SOUNDPLAYER instead
65637WARNING_SOUNDFILEFORMATUnable to play the selected file
65638WARNING_SOUNDERRORUnable to play the sound
65641WARNING_STRING2NOTE(geen eigen melding)
65642WARNING_ARRAYELEMENTElement of array %VARNAME% has not been assigned a value
65649WARNING_REFNOTASSIGNEDVariable %VARNAME% refers to an unassigned variable
65654WARNING_STRINGCONVUnable to convert to a string, '' used
65655WARNING_BOOLEANCONVUnable to convert to a Boolean, false used
65662WARNING_MAPKEY †Map key has not been assigned a value

Zie ook​

Error Codes, Lasterror, Lasterrorextra, Lasterrorline, Lasterrormessage, Offerror, Onerror, ThrowError, Try / Catch / EndTry

Geschiedenis​

2.0.0.0Toegevoegd aan de documentatie