Share via


OnError Event

Occurs when the Silverlight plug-in generates a runtime error.

Scripting (Instantiation)
Silverlight.CreateObject(,,,,{onError:functionName})

-or-

Silverlight.CreateObjectEx({,,,events:{onError:functionName}})
Scripting (Runtime)
silverlightObject.onError = functionName

Event Handler Parameters

sender

object

Identifies the Silverlight plug-in that invoked the event.

errorEventArgs

object

Identifies the error and provides information about its source location. For more information, see ErrorEventArgs.

Remarks

The OnError event provides the means to specify a user-defined JavaScript error handling function that is invoked when an error is generated in the Silverlight runtime components. The default value is null. If you are using the JavaScript helper file, Silverlight.js, and do not set the OnError property to an error handling function, the default error handling function, default_error_handler, is used. For more information on setting this event during plug-in initialization, see Instantiating a Silverlight Plug-in (Using CreateSilverlight.js and Silverlight.js).

For more information on Silverlight errors and error handling, see Silverlight Error Handling. For a list of error messages associated with this event, see Error Messages.

Applies To

Silverlight Plug-in

See Also

Instantiating a Silverlight Plug-in (Using CreateSilverlight.js and Silverlight.js)
Silverlight Error Handling
Error Messages