SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    New Member
    Join Date
    Jan 2011
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Quality Center Errors are not showing

    Hi everybody,

    I'm doing some changes to the Quality Center workflow editor. My code isn't working, but instead of getting an error message from QC, I get nothing.
    I've added On Error GoTo 0 in the beginning of my function, but that also doesn't help.

    Do you guys have any suggestion/ideas?

  2. #2
    Advanced Member
    Join Date
    Aug 2004
    Location
    Wellington, New Zealand
    Posts
    797
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    On Error GoTo 0 <<< this will suppress all error.
    It literally translates to "if there is an error, reset the error object so it disappears"

    comment that line out.
    Regards,

    Alex
    ... just another Tester ...

  3. #3
    New Member
    Join Date
    Jan 2011
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Ow, didn't know that.

    I have removed my On Error GoTo 0 from the method which is failing, but a higher level method which calls the failing method still has On Error GoTo 0. I don't want to change this higher method as I didn't create it. Is there a way to set the error handling back to default?

    I found "On Error GoTo -1", but Quality Center doesn't allow me to save this:
    The script successfully passed syntax check.
    [Error] (L715: c17): Syntax error

  4. #4
    Advanced Member
    Join Date
    Aug 2004
    Location
    Wellington, New Zealand
    Posts
    797
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    If 'On Error GoTo 0' should never be at the TOP of a function (or sub).

    If you look the pattern in the subs and functions that QC/ALM come with out of the box you'll notice that the first thing that often appears after the definition is
    On Error Resume Next

    This translates to something like "if something goes wrong, carry on!"

    On Error GoTo 0 is an instruction to reset the error object if any errors have been raised. To trap and notify of errors a good idea is to write a function to perform this task, and call it at the bottom of your sub immediately before 'On Error GoTo 0'

    For example:

    Code:
    Function someFunction
      On Error Resume Next
    
       ' code in here where something could go wrong
    
      CheckForErrors("someFunction")
      On Error GoTo 0
    End Function
    At the end of someFunction, we will call 'CheckForErrors()' and we will tell it what function we're calling it from. CheckForErrors will let us know if any errors were raised.
    Since we know that following this call the error will have been handled, we can safely reset the err object with On Error Goto 0 back in our original function.

    Now we need to add our CheckForErrors() function. Something like this may help:

    Code:
    Function CheckForErrors(callingFunction)
    
      If Err.Number <> 0 Then
         msgbox "Error raised by " & cstr(callingFunction) & " vbcrlf & "Error number: " & Err.Num & vbcrlf & "Source: " &  Err.Source & vbcrlf & Error Description: " & err.Description
     End If
    
    End Function
    It's worth pointing out that CheckForErrors() is going to be executed whether there's an error or not, but it's only going to pop up a message box if an error does exist.

    Further reading: https://technet.microsoft.com/en-us/...2852.aspx#EHAA
    Regards,

    Alex
    ... just another Tester ...

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:20 PM.

Copyright BetaSoft Inc.