'=========================================================================== ' Subject: ERROR HANDLING Date: 12-20-97 (10:33) ' Author: Alexander Meyer Code: QB, QBasic, PDS ' Origin: Meyer.Karl@t-online.de Packet: MISC.ABC '=========================================================================== ' //// ' 0(o o)0 '-------------------------ooO (_) Ooo--------------------- ' ERROR.BAS -- Written in QuickBasic 4.5 ' ' Name: Error handling ' Author: Alexander Meyer ' Date: 11-23-1997 ' Description: Handle all QBasic errors ' 'For questions or comments mail to: Meyer.Karl@t-online.de '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ON ERROR GOTO Debug RANDOMIZE TIMER Fehler% = INT(RND * 75 + 1) ERROR Fehler% 'Simulate error END Debug: BEEP CLS IF ERDEV$ <> "" AND ERDEV <> 0 THEN PRINT "Error on device "; ERDEV$; " , device error code ="; ERDEV PRINT END IF PRINT "QBasic error code"; ERR SELECT CASE ERR CASE 1: PRINT "NEXT without FOR" CASE 2: PRINT "Syntax error" CASE 3: PRINT "RETURN without GOSUB" CASE 4: PRINT "Out of DATA" CASE 5: PRINT "Illegal function call" CASE 6: PRINT "Overflow" CASE 7: PRINT "Out of memory" CASE 8: PRINT "Label not defined" CASE 9: PRINT "Subscript out of range" CASE 10: PRINT "Duplicate definition" CASE 11: PRINT "Division by zero" CASE 12: PRINT "Illegal in direct mode" CASE 13: PRINT "Type mismatch" CASE 14: PRINT "Out of string space" CASE 16: PRINT "String formula too complex" CASE 17: PRINT "Cannot continue" CASE 18: PRINT "Function not defined" CASE 19: PRINT "No RESUME" CASE 20: PRINT "RESUME without error" CASE 24: PRINT "Device timeout" CASE 25: PRINT "Device fault" CASE 26: PRINT "FOR without NEXT" CASE 27: PRINT "Out of paper" CASE 29: PRINT "WHILE without WEND" CASE 30: PRINT "WEND without WHILE" CASE 33: PRINT "Duplicate label" CASE 35: PRINT "Subprogram not defined" CASE 37: PRINT "Argument-count mismatch" CASE 38: PRINT "Array not defined" CASE 40: PRINT "Variable required" CASE 50: PRINT "FIELD overflow" CASE 51: PRINT "Internal error" CASE 52: PRINT "Bad file name or number" CASE 53: PRINT "File not found" CASE 54: PRINT "Bad file mode" CASE 55: PRINT "File already open" CASE 56: PRINT "FIELD statement activ" CASE 57: PRINT "Device I/O error" CASE 58: PRINT "File already exists" CASE 59: PRINT "Bad record length" CASE 61: PRINT "Disk full" CASE 62: PRINT "Input past end of file" CASE 63: PRINT "Bad record number" CASE 64: PRINT "Bad file name" CASE 67: PRINT "Too many files" CASE 68: PRINT "Device unavailable" CASE 69: PRINT "Communation-buffer overflow" CASE 70: PRINT "Permission denied" CASE 71: PRINT "Disk not ready" CASE 72: PRINT "Disk-media error" CASE 73: PRINT "Feature unavailable" CASE 74: PRINT "Rename across disks" CASE 75: PRINT "Path/File access error" CASE 76: PRINT "Path not found" CASE ELSE: PRINT "Unkown error" END SELECT IF ERL <> 0 THEN PRINT "Line"; ERL END IF END