|
Post by u9 on May 19, 2007 10:10:54 GMT -5
This is really really annoying. When ever there occurs an error in the class_initialize method of an object, the brutus2d just ignores it and exits the class_initialize metods continuing on with the next function call. This really makes debugging a pain in the ***. I cannot count how many hours i have wasted looking for bugs just to finally figure out that there actually was an error (it just didn't get reported).
In the code below after creating a Dummy object surely enough i can continue with the system.debugPrint even though the "creation" partially failed. Option explicit does nothing to catch this error but the errors that get through this method are not limited to typos... any failure that would otherwise terminate the execution of the program seems to get through and Brutus2d continues happily as if nothing had happened.
Option explicit
class Dummy Public tooDumb Public Sub class_initialize system.debugPrint "DEBUG: Starting class_initialize" tooDumb = "tooDumb value 1" Set too_TYPO_Dumb = nothing tooDumb = "tooDumb value 2" system.debugPrint "DEBUG: Done with class_initialize" End Sub End class
Dim baaad Set baaad = New Dummy
system.debugPrint baaad.tooDumb
|
|
|
Post by Guilect on May 20, 2007 8:29:51 GMT -5
We can all thank (or blame) Microsoft for this one. As you know all the code execution, and error detection, is done by the VBScript object. When you hit 'run' from the IDE, all the code is sent to and run by the VBScript object. When the VBScript object comes upon some syntax in the code that it does not understand it generates an error. I then have B2D report the error to you. If VBScript does not report an error when running the code...
I have control over the functions that I add as objects to the VBScripting object. Things like the graphics, sound, etc.
|
|
|
Post by u9 on May 20, 2007 18:38:59 GMT -5
Ok. A safer solution is to just make my own initialize method in my objects and then call them myself
|
|