Fix bug when handling exceptions in certain situations

One example is a type error when evaluating the string argument of
main.step() statements

Change-Id: Ia96a5d0f11996c51ad7221fd5515fde3bed094f3
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index e15b9e1..bc23be0 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -353,12 +353,23 @@
                 self.stepCache += "\t\t" + self.onFailMsg + "\n"
                 self.stepCount = self.stepCount + 1
                 return self.FALSE
-            except StandardError:
-                stepNo = self.stepResults[0][ self.stepNumber - 1]
-                stepName = self.stepResults[1][ self.stepNumber - 1 ]
-                self.log.exception( "\nException in the following section of" +
-                                    " code: " + str( testCaseNumber ) + "." +
-                                    str( stepNo ) + ": " + stepName )
+            except StandardError as e:
+                try:
+                    stepNo = self.stepResults[0][ self.stepNumber - 1 ]
+                except IndexError:
+                    stepNo = "<IndexError>"
+                    main.log.warn( "Error trying to get step number. " +
+                                   "It is likely between step " +
+                                   str( self.stepNumber ) + " and step" +
+                                   str( self.stepNumber + 1 ) )
+                try:
+                    stepName = self.stepResults[1][ self.stepNumber - 1 ]
+                except IndexError:
+                    stepName = "<IndexError>"
+                self.log.error( "\nException in the following section of" +
+                                " code: " + str( testCaseNumber ) + "." +
+                                str( stepNo ) + ": " + stepName )
+                self.log.error( e )
                 self.stepCount = self.stepCount + 1
                 self.logger.updateCaseResults( self )
                 # WIKI results