त्रुटि कोड
त्रुटि कोड
जब प्रोग्राम चलते समय कुछ गड़बड़ होती है, तो BASIC-256 एक रनटाइम त्रुटि या चेतावनी देता है, हर एक का अपना नंबर होता है। LastError पकड़ी गई आख़िरी त्रुटि का नंबर लौटाता है, और LastErrorMessage उसका संदेश। त्रुटियाँ और चेतावनियाँ दोनों Try / Catch / EndTry या OnError से पकड़ी जा सकती हैं।
- 1 से 65535 तक की त्रुटियाँ प्रोग्राम को रोक देती हैं, जब तक उन्हें पकड़ा न जाए।
- 65536 और उससे ऊपर की चेतावनियाँ एक WARNING संदेश दिखाकर प्रोग्राम को चलने देती हैं। चेतावनी का नंबर 65536 और मेल खाने वाली त्रुटि के नंबर का योग है: WARNING_VARNOTASSIGNED 65536 + 13 = 65549 है। वरीयताएँ के उपयोगकर्ता टैब में आप चुनते हैं कि ग़लत प्रकार रूपांतरण और बिना मान वाले चर अनदेखे हों, चेतावनी दें, या त्रुटि दें।
- 0 से नीचे की त्रुटियाँ प्रोग्राम में ही की गई ग़लतियाँ हैं, जैसे कोई लेबल या सबरूटीन न होना, या बहुत गहरा रिकर्शन। इन्हें भी पकड़ा जा सकता है, पर इन्हें प्रोग्राम में ही ठीक करना सबसे अच्छा है।
- ThrowError आपके अपने नंबर वाली त्रुटि देता है। जो नंबर इन तालिकाओं में नहीं है, जैसे 1000 या उससे अधिक, उसका संदेश "User thrown error number" होता है।
संदेश में %VARNAME% की जगह चर का नाम आता है। तालिकाओं का हर नाम एक स्थिरांक भी है जिसे प्रोग्राम इस्तेमाल कर सकता है, जैसे if lasterror = error_divzero then, सिवाय † वाले नामों के, जिनका केवल नंबर है। संदेश अंग्रेज़ी में ही हैं, जैसे BASIC-256 उन्हें दिखाता है।
उदाहरण
onerror nicetrap
print 10 / 0
open 99, "bogus.file"
print "Runs Anyway"
end
nicetrap:
print "error " + lasterror + " on line " + lasterrorline + ": " + lasterrormessage
if lasterror = error_divzero then print "(that was a division by zero)"
return
यह दिखाएगा:
error 50 on line 2: Division by zero
(that was a division by zero)
0.0
error 5 on line 3: Invalid File Number
Runs Anyway
प्रोग्राम में ही की गई त्रुटियाँ
| संख्या | नाम | संदेश |
|---|---|---|
| -1 | ERROR_NOSUCHLABEL | No such label %VARNAME% |
| -3 | ERROR_NOTARRAY | Variable %VARNAME% is not an array |
| -5 | ERROR_ARGUMENTCOUNT | Number of arguments passed does not match FUNCTION/SUBROUTINE definition |
| -6 | ERROR_MAXRECURSE | Maximum levels of recursion exceeded |
| -7 | ERROR_STACKUNDERFLOW | Stack Underflow Error |
| -11 | ERROR_UNSERIALIZEFORMAT | Unable to UnSerialize string |
| -12 | ERROR_NOSUCHSUBROUTINE | No such SUBROUTINE %VARNAME% |
| -13 | ERROR_NOSUCHFUNCTION | No such FUNCTION %VARNAME% |
| -14 | ERROR_ONERRORSUB | SUBROUTINE %VARNAME% expects arguments and therefore can not be used by ONERROR statement |
त्रुटियाँ
| संख्या | नाम | संदेश |
|---|---|---|
| 5 | ERROR_FILENUMBER | Invalid File Number |
| 6 | ERROR_FILEOPEN | Unable to open file |
| 7 | ERROR_FILENOTOPEN | File not open |
| 8 | ERROR_FILEWRITE | Unable to write to file |
| 9 | ERROR_FILERESET | Unable to reset file |
| 10 | ERROR_ARRAYSIZELARGE | Array %VARNAME% dimension too large |
| 11 | ERROR_ARRAYSIZESMALL | Array %VARNAME% dimension too small |
| 12 | ERROR_ARRAYEVEN | Array data must be one dimensional with an even number of elements or two dimemsional with two elements in each row |
| 13 | ERROR_VARNOTASSIGNED | Variable %VARNAME% has not been assigned a value |
| 14 | ERROR_ARRAYNITEMS | Array %VARNAME% rows must have the same number of items |
| 15 | ERROR_ARRAYINDEX | Array %VARNAME% index out of bounds |
| 17 | ERROR_STRSTART | Starting position less than zero |
| 20 | ERROR_RGB | RGB Color values must be in the range of 0 to 255 |
| 23 | ERROR_POLYPOINTS | Not enough points in array for poly()/stamp() |
| 24 | ERROR_IMAGEFILE | Unable to load image file |
| 25 | ERROR_SPRITENUMBER | Sprite number out of range |
| 26 | ERROR_SPRITENA | Sprite has not been assigned |
| 27 | ERROR_SPRITESLICE | Unable to slice image |
| 28 | ERROR_FOLDER | Invalid directory name |
| 29 | ERROR_INFINITY | Operation returned infinity |
| 30 | ERROR_DBOPEN | Unable to open SQLITE database |
| 31 | ERROR_DBQUERY | Database query error (message follows) |
| 32 | ERROR_DBNOTOPEN | Database must be opened first |
| 33 | ERROR_DBCOLNO | Column number out of range or column name not in data set |
| 34 | ERROR_DBNOTSET | Record set must be opened first |
| 35 | ERROR_NUMBERCONV | Unable to convert to number |
| 36 | ERROR_NETSOCK | Error opening network socket |
| 37 | ERROR_NETHOST | Error finding network host |
| 38 | ERROR_NETCONN | Unable to connect to network host |
| 39 | ERROR_NETREAD | Unable to read from network connection |
| 40 | ERROR_NETNONE | Network connection has not been opened |
| 41 | ERROR_NETWRITE | Unable to write to network connection |
| 42 | ERROR_NETSOCKOPT | Unable to set network socket options |
| 43 | ERROR_NETBIND | Unable to bind network socket |
| 44 | ERROR_NETACCEPT | Unable to accept network connection |
| 45 | ERROR_NETSOCKNUMBER | Invalid Socket Number |
| 46 | ERROR_PERMISSION | You do not have permission to use this statement/function |
| 47 | ERROR_IMAGESAVETYPE | Invalid image save type |
| 50 | ERROR_DIVZERO | Division by zero |
| 53 | ERROR_FREEFILE | There are no free file numbers to allocate |
| 54 | ERROR_FREENET | There are no free network connections to allocate |
| 55 | ERROR_FREEDB | There are no free database connections to allocate |
| 56 | ERROR_DBCONNNUMBER | Invalid Database Connection Number |
| 57 | ERROR_FREEDBSET | There are no free data sets to allocate for that database connection |
| 58 | ERROR_DBSETNUMBER | Invalid data set number |
| 59 | ERROR_DBNOTSETROW | You must advance the data set using DBROW before you can read data from it |
| 60 | ERROR_PENWIDTH | Drawing pen width must be a non-negative number |
| 62 | ERROR_ARRAYINDEXMISSING | Array variable %VARNAME% has no value without an index |
| 63 | ERROR_IMAGESCALE | Image scale must be greater than or equal to zero |
| 66 | ERROR_RADIXSTRING | Unable to convert radix string back to a decimal number |
| 67 | ERROR_RADIX | Radix conversion base muse be between 2 and 36 |
| 68 | ERROR_LOGRANGE | Unable to calculate the logarithm of a number less than or equal to 0 |
| 69 | ERROR_STRINGMAXLEN | String exceeds maximum length of 16,777,216 characters |
| 71 | ERROR_PRINTERNOTON | Printer is not on |
| 72 | ERROR_PRINTERNOTOFF | Printing is already on |
| 73 | ERROR_PRINTEROPEN | Unable to open printer |
| 78 | ERROR_FILEOPERATION | Can not perform that operation on a Serial Port |
| 79 | ERROR_SERIALPARAMETER | Invalid serial port parameter |
| 80 | ERROR_LONGRANGE | Number exceeds long integer range (minimum to maximum) |
| 81 | ERROR_INTEGERRANGE | Number exceeds integer range (minimum to maximum) |
| 82 | ERROR_SLICESIZE | Invalid Slice dimensions |
| 83 | ERROR_ARRAYLENGTH2D | Can not get a single length of a two dimensional array |
| 84 | ERROR_EXPECTEDARRAY | Expected array |
| 85 | ERROR_VARNULL | Variable %VARNAME% refers to a non-existent variable |
| 86 | ERROR_VARCIRCULAR | Circular reference in variable %VARNAME% |
| 87 | ERROR_IMAGERESOURCE | Specified image resource not found |
| 88 | ERROR_SOUNDRESOURCE | Specified sound resource not found |
| 89 | ERROR_INVALIDRESOURCE | Specified resource not found |
| 90 | ERROR_SOUNDFILE | Unable to load sound file |
| 91 | ERROR_SOUNDNOTSEEKABLE | (केवल चेतावनी के रूप में इस्तेमाल) |
| 92 | ERROR_SOUNDLENGTH | (केवल चेतावनी के रूप में इस्तेमाल) |
| 93 | ERROR_DOWNLOAD | Error downloading file |
| 94 | ERROR_EXPECTEDSOUND | Expected sound |
| 95 | ERROR_TOOMANYSOUNDS | Too many sound instances |
| 96 | ERROR_ENVELOPEODD | Envelope data must contain at least 4 elements and an even number of elements |
| 97 | ERROR_ENVELOPEMAX | It was exceeded the maximum length of an envelope, which is 20 seconds |
| 98 | ERROR_HARMONICNUMBER | Harmonic number must be an integer greater than zero |
| 99 | ERROR_HARMONICLIST | Harmonics list must be one dimensional array with an even number of elements or two dimemsional array with two elements in each row |
| 100 | ERROR_WAVOBSOLETE | (केवल चेतावनी के रूप में इस्तेमाल) |
| 101 | ERROR_SOUNDFILEFORMAT | (केवल चेतावनी के रूप में इस्तेमाल) |
| 102 | ERROR_SOUNDERROR | (केवल चेतावनी के रूप में इस्तेमाल) |
| 103 | ERROR_ONEDIMENSIONAL | Expects one dimensional array or one dimensional list of elements |
| 104 | ERROR_WAVEFORMLOGICAL | Creating custom waveform using logical coordinates it request at least 3 elements |
| 105 | ERROR_STRING2NOTE | Unable to convert string to musical note |
| 106 | ERROR_ARRAYELEMENT | Element of array %VARNAME% has not been assigned a value |
| 107 | ERROR_SETTINGSGETACCESS | The program does not have permission to read settings from other program. Check access level from 'Preferences' panel |
| 108 | ERROR_SETTINGSSETACCESS | The program does not have permission to write settings for other program. Check access level from 'Preferences' panel |
| 109 | ERROR_INVALIDPROGNAME | Invalid program name |
| 110 | ERROR_INVALIDKEYNAME | Invalid key name |
| 111 | ERROR_SETTINGMAXLEN | Setting string exceeds maximum length of 16,383 characters |
| 112 | ERROR_SETTINGMAXKEYS | The maximum number of keys for this program has been exceeded |
| 113 | ERROR_REFNOTASSIGNED | Variable %VARNAME% refers to an unassigned variable |
| 114 | ERROR_UNEXPECTEDRETURN | Unexpected RETURN |
| 115 | ERROR_NEXTNOFOR | Next without FOR |
| 116 | ERROR_SQRRANGE | Unable to calculate the root of a negative number |
| 117 | ERROR_ASINACOSRANGE | Unable to calculate the arc-sine or arc-cosine of a value outside the interval [-1.0, +1.0] |
| 118 | ERROR_STRINGCONV | Unable to convert to a string |
| 119 | ERROR_BOOLEANCONV | Unable to convert to a Boolean |
| 120 | ERROR_ARRAYEXPR | Array Expression Expected. |
| 121 | ERROR_NUMBEREXPR | Numeric Expression Expected. |
| 122 | ERROR_STRINGEXPR | String Expression Expected. |
| 123 | ERROR_ZEROORONE † | Zero or one expected. |
| 124 | ERROR_NOTMAP † | Variable %VARNAME% is not a map |
| 125 | ERROR_ARRAYORMAPEXPR † | Array or Map Expression Expected. |
| 126 | ERROR_MAPKEY † | Map key does not exist |
| 128 | ERROR_MKDIR † | Unable to create new folder |
| 129 | ERROR_NOTAVAILABLE † | Feature not available on this platform |
| 130 | ERROR_WINDOWSIZE † | WINDOW needs a width and a height that are not zero |
| 131 | ERROR_MATNOTMATRIX † | MAT needs an array for %VARNAME%, not a single value |
| 132 | ERROR_MATDIM † | MAT needs both matrices to have the same number of rows and the same number of columns |
| 133 | ERROR_MATMULDIM † | MAT MUL needs the first matrix to have as many columns as the second has rows |
| 134 | ERROR_MATNOTSQUARE † | MAT INV needs a square matrix |
| 135 | ERROR_MATSINGULAR † | MAT INV can not invert a singular matrix |
| 136 | ERROR_VECNOTVECTOR † | DOT, CROSS, NORM and UNIT need an array, not a single value |
| 137 | ERROR_VECDIM † | DOT and CROSS need both vectors to have the same number of elements |
| 138 | ERROR_CROSSDIM † | CROSS needs vectors of two or three elements |
| 139 | ERROR_VECELEMENT † | the vector has an element that has not been given a value |
| 140 | ERROR_VECZERO † | UNIT can not make a unit vector from a vector of length zero |
| 141 | ERROR_HSV † | HSV needs a hue from 0 to 360, and saturation, value and alpha from 0 to 100 |
| 65535 | ERROR_NOTIMPLEMENTED | Feature not implemented in this environment |
चेतावनियाँ
| संख्या | नाम | संदेश |
|---|---|---|
| 65549 | WARNING_VARNOTASSIGNED | Variable %VARNAME% has not been assigned a value |
| 65571 | WARNING_NUMBERCONV | Unable to convert string to number, zero used |
| 65616 | WARNING_LONGRANGE | Number exceeds long integer range (minimum to maximum), zero used |
| 65617 | WARNING_INTEGERRANGE | Number exceeds integer range (minimum to maximum), zero used |
| 65627 | WARNING_SOUNDNOTSEEKABLE | Media file is not seekable |
| 65628 | WARNING_SOUNDLENGTH | Duration is not available for media file |
| 65636 | WARNING_WAVOBSOLETE | WAVPLAY suite is obsolete. Use SOUND/SOUNDPLAY/SOUNDPLAYER instead |
| 65637 | WARNING_SOUNDFILEFORMAT | Unable to play the selected file |
| 65638 | WARNING_SOUNDERROR | Unable to play the sound |
| 65641 | WARNING_STRING2NOTE | (इसका अपना कोई संदेश नहीं) |
| 65642 | WARNING_ARRAYELEMENT | Element of array %VARNAME% has not been assigned a value |
| 65649 | WARNING_REFNOTASSIGNED | Variable %VARNAME% refers to an unassigned variable |
| 65654 | WARNING_STRINGCONV | Unable to convert to a string, '' used |
| 65655 | WARNING_BOOLEANCONV | Unable to convert to a Boolean, false used |
| 65662 | WARNING_MAPKEY † | Map key has not been assigned a value |
यह भी देखें
त्रुटि कोड, Lasterror, Lasterrorextra, Lasterrorline, Lasterrormessage, Offerror, Onerror, ThrowError, Try / Catch / EndTry
इतिहास
| 2.0.0.0 | प्रलेखन में जोड़ा गया |