Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error message from number
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00468523
Message ID:
00468538
Vues:
12
>Is there a function that you can feed an error number to and have it return the error message? I went looking all through the help, and if it's there, I missed it.

The following code is what I have used to create a table of all error codes and messages. My errors table has the fields ErrNum (I) and Descript (200) field
#Include FoxPro.h
local lcTable
lcTable = ""
lcTable = getfile("Error Table:DBF")
if empty(lcTable)
   return
endif
close tables all
use (lcTable) excl alias Errors
local lnRetVal
lnRetVal = MessageBox("Zap table first?", MB_ICONQUESTION + MB_YESNO, "Warning...")
if lnRetVal = IDYES
   zap
endif
set order to errnum
insert into Errors ( ErrNum, Descript ) values ( 1116, "Too many windows open." )
on error do SetError
for i = 3000 to 5000
   if i = 1116      && Too many window open error which stops execution
      loop
   endif
   error(i)
endfor
on error
return


procedure SetError
*
local array laError[1]
local llInsert
lnRetVal = aerror(laError)
if lnRetVal = 0
   return
endif
llInsert = .t.
if laError[1,1] = 1941
   seek 1941
   if not eof()
      llInsert = .f.
   endif
endif
if llInsert
   insert into Errors ( errnum, descript ) ;
      values ( laError[1,1], laError[1,2] )
endif
return
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform