Determine What is Calling my Subroutine

Discussion in 'ASP General' started by Bill, Jul 29, 2003.

  1. Bill

    Bill Guest

    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
     
    Bill, Jul 29, 2003
    #1
    1. Advertising

  2. Bill

    Bob Barrows Guest

    Bill wrote:
    > 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.
     
    Bob Barrows, Jul 29, 2003
    #2
    1. Advertising

  3. Bill

    Ray at Guest

    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

    "Bill" <> wrote in message
    news:...
    > 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
    >
    >
     
    Ray at, Jul 29, 2003
    #3
  4. > 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...
     
    Aaron Bertrand - MVP, Jul 29, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. asadikhan
    Replies:
    2
    Views:
    3,712
    =?Utf-8?B?SG1udA==?=
    Apr 25, 2004
  2. sck10

    Calling another subroutine

    sck10, Aug 15, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    473
    =?Utf-8?B?U3JlZWppdGggUmFt?=
    Aug 15, 2005
  3. Bigdakine

    Calling fortran subroutine from c

    Bigdakine, Sep 1, 2004, in forum: C Programming
    Replies:
    13
    Views:
    688
    Mark L Pappin
    Sep 25, 2004
  4. Amit

    Calling subroutine in fortran module

    Amit, Jan 30, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,732
    Dave Thompson
    Feb 7, 2005
  5. king
    Replies:
    5
    Views:
    210
Loading...

Share This Page