RuntimeErrorEventArgs Object
Provides data for runtime error events.
XAML |
Cannot be used in XAML.
|
Scripting |
Obtained as arguments for certain event handlers.
|
Properties
CharPosition, ErrorCode, ErrorMessage, ErrorType, LineNumber, MethodName, Name
Methods
Equals, FindName, GetHost, GetValue, SetValue
By specifying error handlers as part of initial Silverlight plug-in instantiation code, you can introduce custom error handling even for runtime errors, including suppressing error dialog boxes. For details, see Silverlight Application Scripting Error Handling.
Examples
The following JavaScript example shows the portion of an event handler that displays error information specific to runtime errors.
JavaScript |
---|
// errorArgs is an instance of RuntimeErrorEventArgs if(errorArgs.ErrorType == "RuntimeError") { var runtimeErrorMsg = "Silverlight Runtime Error \n\n"; // Basic error event informaiton. runtimeErrorMsg += "Error Type: " + errorArgs.errorType + "\n"; runtimeErrorMsg += "Error Message: " + errorArgs.errorMessage + "\n"; runtimeErrorMsg += "Error Code: " + errorArgs.errorCode + "\n"; // Runtime specific error event information. if (errorArgs.lineNumber != 0) { runtimeErrorMsg += "Line: " + errorArgs.lineNumber + "\n"; runtimeErrorMsg += "Position: " + errorArgs.charPosition + "\n"; } runtimeErrorMsg += "MethodName: " + errorArgs.methodName + "\n"; alert(runtimeErrorMsg); } |
See Also
Silverlight Application Scripting Error Handling
ErrorEventArgs
ParserErrorEventArgs