• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

Error Tracing / Call Stack

I've been taking a look at several error handling stratagies (especially in the Advanced MS VB 6.0 book) and I'm stumped.

How can I track "re-raised" errors across DLLs?  For example:

            Sub Start()
                  Call Test1.Test1

            Sub Test1()
                  Call Test2.Test2

                  Err.Raise 5, "Source", "Description"

Client.EXE calls Test1.Test1, which calls Test2.Test2 where an error occurs.  The error handler in Test2.Test2 raises the unhandled error which is caught by the error handler in Test1.Test1, which again raises the unhandled error to the error handler in Client.Start.  At this point I would like to walk through a stack and display something like:

      5, Source, Description, Test2.Test2
      5, Source, Description, Test1.Test1
      5, Source, Description, Client.Start

Any suggestions?

Thanks for your time, Richard
1 Solution
What I did is that I create a global ErrorHandler and
compiled as "Global MutilUser" DLL and reference it from
all my DLLs and EXEs. No matter where an error occurs, it
will handed by the ErrorHandler and do what you like it
to do, return to UI to show the error or write to a log

richardwhiteAuthor Commented:
I got it.  The subtle part is to place the storage for the class in a standard module so that each instance of the class sees the same call stack.

Chapter 5, Heading "Instance data versus shared data", in Hardcore VB 5.0 has a good description of this.

Thanks for the help, Richard
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now