Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Error Tracing / Call Stack

Posted on 1999-08-29
Medium Priority
Last Modified: 2012-05-05
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
Question by:richardwhite
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

fmas earned 300 total points
ID: 1534430
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


Author Comment

ID: 1534431
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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question