I get the jist of it, and it make sense. Originally I was just hoping for some magical trigger or hidden method of the Error object, or some side effect of catch, but I'm guessing that's entirely handled by the vm. This makes sense though
I'm still looking at my class above saying "How can a parent class know what the child is doing!!" But it works... scary! On 8/14/07, Hans Wichman <[EMAIL PROTECTED]> wrote: > > ps i noticed they are still old sources online, but the general principle > is > the same, contact me offlist if you'd like the latest sources of that > example. > > On 8/14/07, Hans Wichman <[EMAIL PROTECTED]> wrote: > > > > Hi, > > ive implemented this for AS2: > > http://www.objectpainters.com/downloads/globalerrorhandler.zip > > > > Basically, each exception subclasses RuntimeException. > > > > Each time a RuntimeException is created, is it scheduled to be displayed > > to the user after the current call unwinds, unless the exception is > > consumed. This adds a little overhead, eg instead of > > > > try { > > ..} catch (e) { > > print > > } > > > > you would have to do: > > try { > > ..} catch (e) { > > print > > e.consume(); > > } > > > > If the error is not consumed before the current call returns, the > > onUncaughtException method will be called on a IRuntimeExceptionHandler. > You > > can implement and set this handler yourself, be it a dialog, a call to a > > serverside script etc. > > > > HTH > > JC > > > > > > > > On 8/14/07, Jer Brand <[EMAIL PROTECTED]> wrote: > > > > > > What I was after was a little different. I was originally hoping to > > > have > > > uncaught errors trigger a loadvars object to send a message to a php > > > page > > > using error_log(). > > > > > > I did come up with an alternative, though I have a nagging feeling > that > > > I'm > > > utilizing a bug to do what I want -- unless a parent class should know > > > it's > > > been implemented in a subclass using a particular interface. > > > > > > Here's my cheesize solution for my primary Error class: > > > > > > import ICritical ; > > > import IReported ; > > > > > > class StdError extends Error > > > { > > > public var message:String ; > > > private static var sendError:LoadVars ; > > > private static var errorSrc:String = ""; > > > > > > function StdError(msg:String) > > > { > > > message = msg ; > > > > > > if(this instanceof ICritical) > > > { > > > // display a message > > > stdout.error("error is critical") ; > > > } > > > if(this instanceof IReported) > > > { > > > stdout.error("error was reported to qa") ; > > > if(sendError == undefined) > > > { > > > StdError.sendError = new LoadVars() ; > > > } > > > StdError.sendError.message = message ; > > > StdError.sendError.name <http://stderror.senderror.name/> = > > > name ; > > > StdError.sendError.sendAndLoad(StdError.errorSrc, null) ; > > > } > > > } > > > > > > public function get name():String > > > { > > > return "StdError"; > > > } > > > > > > public function toString():String > > > { > > > return name + ": " + message ; > > > } > > > } > > > > > > with child classes just implementing the interface to trigger the > > > behavior > > > like : > > > > > > class CriticalReportedError extends StdError implements ICritical, > > > IReported > > > { > > > function CriticalReportedError(message) > > > { > > > super(message) ; > > > } > > > public function get name():String > > > { > > > return "CriticalReportedError"; > > > } > > > > > > This feels like I'm doing something very, very wrong... Seem stupid to > > > anyone else? > > > _______________________________________________ > > > Flashcoders@chattyfig.figleaf.com > > > To change your subscription options or search the archive: > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > Brought to you by Fig Leaf Software > > > Premier Authorized Adobe Consulting and Training > > > http://www.figleaf.com > > > http://training.figleaf.com > > > > > > > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com