Export (0) Print
Expand All

IObserver(Of T).OnError Method

.NET Framework 4.6 and 4.5

Notifies the observer that the provider has experienced an error condition.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Sub OnError ( _
	error As Exception _


Type: System.Exception

An object that provides additional information about the error.

Although error is an object that is derived from System.Exception, it does not necessarily represent an exception that is thrown by the provider. It can also represent a routine or expected error condition, such as data that is missing or unavailable. The OnError method should be seen as informational, and the provider should not expect the observer to provide error handling.

The following example provides an implementation of the OnError method in a latitude/longitude tracking application. The method simply reports that data is currently unavailable; it does not make use of the Exception object passed to it as a parameter. See the Example section of the IObserver(Of T) topic for the complete example.

Public Overridable Sub OnError(ByVal e As System.Exception) Implements System.IObserver(Of Location).OnError
   Console.WriteLine("{0}: The location cannot be determined.", Me.Name)
End Sub

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
© 2015 Microsoft