'=========================================================================== ' Subject: ERROR TRAPPING Date: 09-24-97 (12:42) ' Author: Michael S. Halpin Code: QB, QBasic, PDS ' Origin: calvarygames@juno.com Packet: MISC.ABC '=========================================================================== 'I release this program to public domain. 'Anyone who wishes to use this program may as long as they give credit to me 'and Calvary Games in the credits. If you weren't planning credits start 'planning them now. ' '-=> ERROR.BAS <=- 'Copyright 1997-98 'Calvary Games 'Allrights Reserved DECLARE SUB ErrorTrap (ErrorCode) ON ERROR GOTO ErrTrap '========Erase everthing between these lines before Before Programming========== 'These are just example lines that simulates an error trap when using 'this program. Delete them before starting. CLS INPUT "Enter a value between 0-255: ", A ErrorTrap A PRINT PRINT "Press any key to continue..." A$ = INPUT$(1) '=============================================================================== ErrTrap: ErrorTrap ERR SUB ErrorTrap (ErrorCode) SCREEN 0 WIDTH 80 COLOR 7, 0 CLS PRINT "SYSTEM ERROR!" PRINT "Error Code: " + LTRIM$(RTRIM$(STR$(ErrorCode))) PRINT "Description: "; IF ErrorCode = 1 THEN PRINT "NEXT without FOR." END END IF IF ErrorCode = 2 THEN PRINT "Syntax error." END END IF IF ErrorCode = 3 THEN PRINT "RETURN without GOSUB." END END IF IF ErrorCode = 4 THEN PRINT "Out of DATA." END END IF IF ErrorCode = 5 THEN PRINT "Illegal function call." END END IF IF ErrorCode = 6 THEN PRINT "Overflow." END END IF IF ErrorCode = 7 THEN PRINT "Out of memory." END END IF IF ErrorCode = 8 THEN PRINT "Label not defined." END END IF IF ErrorCode = 9 THEN PRINT "Subscript out of range." END END IF IF ErrorCode = 10 THEN PRINT "Duplicate definition." END END IF IF ErrorCode = 11 THEN PRINT "Division by zero." END END IF IF ErrorCode = 12 THEN PRINT "Illegal in direct mode." END END IF IF ErrorCode = 13 THEN PRINT "Type mismatch." END END IF IF ErrorCode = 14 THEN PRINT "Out of string space." END END IF IF ErrorCode = 15 THEN PRINT "String formula too complex." END END IF IF ErrorCode = 16 THEN PRINT "Cannot continue." END END IF IF ErrorCode = 17 THEN PRINT "Function not defined." END END IF IF ErrorCode = 18 THEN PRINT "No RESUME." END END IF IF ErrorCode = 19 THEN PRINT "RESUME without error." END END IF IF ErrorCode = 20 THEN PRINT "Device timeout." END END IF IF ErrorCode = 24 THEN PRINT "Device fault." END END IF IF ErrorCode = 25 THEN PRINT "FOR without NEXT." END END IF IF ErrorCode = 26 THEN PRINT "Out of paper." END END IF IF ErrorCode = 27 THEN PRINT "WHILE without WEND." END END IF IF ErrorCode = 29 THEN PRINT "WEND without WHILE." END END IF IF ErrorCode = 30 THEN PRINT "Duplicate label." END END IF IF ErrorCode = 33 THEN PRINT "Subprogram not defined." END END IF IF ErrorCode = 35 THEN PRINT "Argument-count mismatch." END END IF IF ErrorCode = 37 THEN PRINT "Array not defined." END END IF IF ErrorCode = 38 THEN PRINT "Variable required." END END IF IF ErrorCode = 40 THEN PRINT "FIELD overflow." END END IF IF ErrorCode = 50 THEN PRINT "Internal error." END END IF IF ErrorCode = 51 THEN PRINT "Bad file name or number." END END IF IF ErrorCode = 52 THEN PRINT "File not found." END END IF IF ErrorCode = 53 THEN PRINT "Bad file mode." END END IF IF ErrorCode = 54 THEN PRINT "File already open." END END IF IF ErrorCode = 55 THEN PRINT "FIELD statement active." END END IF IF ErrorCode = 56 THEN PRINT "Device I/O error." END END IF IF ErrorCode = 57 THEN PRINT "File already exists." END END IF IF ErrorCode = 58 THEN PRINT "Bad record length." END END IF IF ErrorCode = 59 THEN PRINT "Disk full." END END IF IF ErrorCode = 62 THEN PRINT "Input past end of file." END END IF IF ErrorCode = 63 THEN PRINT "Bad record number." END END IF IF ErrorCode = 64 THEN PRINT "Bad file name." END END IF IF ErrorCode = 67 THEN PRINT "Too many files." END END IF IF ErrorCode = 68 THEN PRINT "Device unavailable." END END IF IF ErrorCode = 69 THEN PRINT "Communication-buffer overflow." END END IF IF ErrorCode = 70 THEN PRINT "Permission denied." END END IF IF ErrorCode = 71 THEN PRINT "Disk not ready." END END IF IF ErrorCode = 72 THEN PRINT "Disk-media error." END END IF IF ErrorCode = 73 THEN PRINT "Feature unavailable." END END IF IF ErrorCode = 74 THEN PRINT "Rename across disks." END END IF IF ErrorCode = 75 THEN PRINT "Path/File access error." END END IF IF ErrorCode = 76 THEN PRINT "Path not found." END END IF PRINT "Unknown error." END END SUB