Determine What is Calling my Subroutine

B

Bill

I've got a subroutine, defined as Private, takes two parameters, that is
called lots of times from different ASP scripts. I need specific error
handling when it is called from only one particular section of my code - and
from the page it's called from, it's called multiple times from there, too,
so I can't check by page.

I thought about adding an additional parameter, but it's called so many
times that it would be unwieldy to do so.

Is there a way I can tell a Private Subroutine what piece of code called it?

ba
 
B

Bob Barrows

Bill said:
I've got a subroutine, defined as Private, takes two parameters, that
is called lots of times from different ASP scripts. I need specific
error handling when it is called from only one particular section of
my code - and from the page it's called from, it's called multiple
times from there, too, so I can't check by page.

I thought about adding an additional parameter, but it's called so
many times that it would be unwieldy to do so.

Is there a way I can tell a Private Subroutine what piece of code
called it?

ba

No. You'll have to add the extra parameter.
 
R

Ray at

No, but you can put some error trapping in the sub to perhaps give you an
idea:

sub whatever(x,y)
on error resume next
your code
If err.number <> 0 Then
response.write "An error occurred. Here are the argument values that
were passed.<br>"
response.write x & "<br>"
response.write y
response.end
End If

End Sub

Ray at work
 
A

Aaron Bertrand - MVP

No. You'll have to add the extra parameter.

Or, create a second subroutine, which calls the first *and* does the
logging, and change only those calls where you want the different behavior.
Might save a bit of work...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top