IObserver<T>.OnError Method (Exception)

.NET Framework (current version)
 

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

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

void OnError(
	Exception error
)

Parameters

error
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<T> topic for the complete example.

public virtual void OnError(Exception e)
{
   Console.WriteLine("{0}: The location cannot be determined.", this.Name);
}

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: