Forum Discussion

mmkumaram's avatar
mmkumaram
Occasional Contributor
13 years ago

Jscript exception Line number

When an exception caught is it possible to find the line number which caused the exception?.



ex:

try

{

log.Message("Test1");

log.Message("Test2");

log.Message("Test3");

}

catch (e)

{

// Posts an exception message to the test log

Log.Error(e.description);

}



Here if execption occurs on Test2, i get an exception description, but i would like to know the line number as well. Is this possible?. 



Thanks,

Muthu
  • Double click on Exception, you are redirected to the line where exception occours
  • mmkumaram's avatar
    mmkumaram
    Occasional Contributor
    Clicking on exception from test log takes to you to the Log.Error line, but not to log.Message line.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Muthu,


     


    In the current TestComplete version, that's impossible. However, we have an appropriate suggestion in our DB, and your request has increased its rating. Thanks.


     

  • mmkumaram's avatar
    mmkumaram
    Occasional Contributor
    ok, thanks for increasing the rating. 



    We have quite a lot manual scripts and script extensions, so having this feature will be really usefull for us. Will Look forward in the next version



    Regards,

    Muthu





  • vajindarladdad's avatar
    vajindarladdad
    Frequent Contributor
    Hi Muthu,

    If you look at the "Additional Information" section. it will show you more details about the errors.

    Also , to add further , you can use "Err" object if you are using VB script.




    try {
    // Throw an error.
    throw new Error(42,"No question");
    } catch(e) {
    print(e)
    // Extract the error code from the error number.
    print(e.number & 0xFFFF)
    print(e.description)
    }



    Please visit the link:



    http://msdn.microsoft.com/en-us/library/vstudio/t9zk6eay%28v=vs.100%29.aspx





    I hope this has been of some help.
  • Any updates on this?



    I could really use this within my tests.



    Thanks,

    Sergiu
  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor

    *would also like to see this if possible*

     

    :robotvery-happy:

  • gboston's avatar
    gboston
    New Contributor

    Is this feature request still in progress? When an exception occurs the call stack only shows the line number of the statement in the catch, not the actual line number of what caused the exception. This makes it very difficult to track down where the exception accually occured. The exception object doesn't seem to have the line number in it either. I am forced into going back through previous log.messages in the log before the exception occured and guessing at where the exception actually came from. I am using jscript in TestComplete 10.3 if that matters.

  • Gradnok's avatar
    Gradnok
    New Contributor

    Hi,

     

    we also look forward to this feature. Finding bugs where the exception is caught consumes a massive amount of time. Especially if the exception occurs in very deep method calls.

     

    br

    Andreas