Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error message from number
Message
From
25/01/2001 12:04:04
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00468523
Message ID:
00468546
Views:
14
Hmmm... I'm guessing that if you went through all that work, then there isn't a function. :)

Thanks, but that's far more work than simply writing a method to handle the error. The problem was that I wanted to do something like:

ON ERROR gnErrNum = ERROR() AND gcErrMess = MESSAGE()

Which, of course, doesn't work. I was trying to avoid having to write a seperate method to assign those global variables, so I hoped to be able to just assign gnErrNum and derive the gcErrMess from that.

It wouldn't be so bad if you could put procedures in methods. I just hate adding a method to the form that's only used in one little snippet of code. :)

Thanks,

Michelle



>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform