Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Jan 19, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Maintain Call Stack for Error Tracing

I program all reusable components into DLLs or OCXs. To provide a consistent error-handling technique across all my projects, I use the Raise method of the Err object in all these components and display the error only in the code module of first entry—such as Command1_Click. Because an error can be generated several layers deep in the code, I propagate the location of the error using this Raise statement in all my reusable components:
	Err.Raise Err.Number, "ThisProc" & vbCr & Err.Source
Exit Sub
This way, the whole call stack is returned to—and can be displayed in—the calling procedure (through Err.Source), making errors much easier to find and solve.
Harvey Flaisher
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date