Ask a Question

Exception error is not printing

sunrays123
Occasional Contributor

Exception error is not printing

def verify_saved_threshold_properties(fileName):
  bResult = False
  failureCount = 0
  :
  try:
      : 
      for i in range(0, aString.Length):
        str = aString.GetValue(i)
        for key, val in threshold_dict.items():
          if str.contains(key):                   
            if str.contains(mapped_value):
              Log.Message(mapped_value + " value is present in saved setting dialog against {0} ".format(key))
              break
            else:
              failureCount += 1
              Log.Message(mapped_value + " value is not present in saved setting dialog against {0}".format(key))
          else:
            continue

      bResult = False if failureCount > 0 else True

    else:
      :
      bResult = False

  except AttributeError as error:
    Log.Error(__name__ + " error!! " + str(error))
    
  except Exception as error:
    Log.Error(__name__ + " error!! " + str(error))
    bResult = True

  finally:
    return bResult

Hi, All I am using a python script and trying to print exception error, but unfortunately, it is not printing. In the above code, an AttributeError exception is caught but the message is not logged.

 

Can somebody please help?

2 REPLIES 2
Marsha_R
Community Hero

Re: Exception error is not printing

Are you sure that it's actually being caught?  How can you tell?


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
sunrays123
Occasional Contributor

Re: Exception error is not printing

Yes. I checked by debugging the code.

cancel
Showing results for 
Search instead for 
Did you mean: