From: David on 27 Mar 2010 10:09 I just learned something after all these years. DUH!!!! Err.Number and Err.Description is assignable with your own Number and Description. Never seen this mentioned anywhere. Hence if you do: Err.Raise MY_ERR_CONSTANT in the local error procedure you can assign: Err.Number = MY_ERR_CONSTANT Err.Description = "this is my Error" ==================== This can then be handled by your global error routine "Larry Serflaten" <serflaten(a)usinternet.com> wrote in message news:u8DV6ZazKHA.4492(a)TK2MSFTNGP05.phx.gbl... > > "David" <NoWhere(a)earthlink.net> wrote > >> Where I'm having issues is screening for User Errors versus System Errors >> in >> the calling procedure and do it in "one" call. > > What is the issue with system errors vs user errors? It seems to me you > only > need to know the description when you plan to show it or log it somewhere. > > Could you not just add vbObjectError (or some other suitable value) to > errors > caused by the user and then test the Err.Number to determine if you should > show the description from the Err object or call one up from your own > list? > > LFS > >
From: Bob Butler on 27 Mar 2010 10:18 "David" <NoWhere(a)earthlink.net> wrote in message news:%23OB7XcbzKHA.2016(a)TK2MSFTNGP02.phx.gbl... >I just learned something after all these years. DUH!!!! > > Err.Number and Err.Description is assignable with your > own Number and Description. > Never seen this mentioned anywhere. > > Hence if you do: > > Err.Raise MY_ERR_CONSTANT > > in the local error procedure you can assign: > > Err.Number = MY_ERR_CONSTANT > Err.Description = "this is my Error" > > ==================== > This can then be handled by your global error routine Why wouldn't you just supply the info in the err.raise Err.Raise vbObjectError + 1024, "My Procedure Name", "My Error Description"
From: David on 27 Mar 2010 10:48
Mr. Butler: What you suggest is "doable", but I currently have more info that I have been getting: Was doing: With TError .Type (enum -- Critical, Warning, Info) .Name (Module and proc name) .Action (enum - MsgOnly, MsgAndLog, LogOnly) .Data (string with specific info I want) End With DoError There is a lot of other info in the main error module: (which computer, timestamps, etc) which are not part of a normal procedure. ================= Since I now realize I can assign my error description to Err.Description (lighting strikes sometimes :>)) , I'm looking at getting rid of my TError structure and doing: Err.Description = string with specific info I want (formerly .Data) DoError (Type, Name, Action) Will still do what's needed, but I believe a little cleaner code. "Bob Butler" <noway(a)nospam.ever> wrote in message news:uD9AeibzKHA.4492(a)TK2MSFTNGP05.phx.gbl... > > "David" <NoWhere(a)earthlink.net> wrote in message > news:%23OB7XcbzKHA.2016(a)TK2MSFTNGP02.phx.gbl... >>I just learned something after all these years. DUH!!!! >> >> Err.Number and Err.Description is assignable with your >> own Number and Description. >> Never seen this mentioned anywhere. >> >> Hence if you do: >> >> Err.Raise MY_ERR_CONSTANT >> >> in the local error procedure you can assign: >> >> Err.Number = MY_ERR_CONSTANT >> Err.Description = "this is my Error" >> >> ==================== >> This can then be handled by your global error routine > > Why wouldn't you just supply the info in the err.raise > > Err.Raise vbObjectError + 1024, "My Procedure Name", "My Error > Description" > |