IObserver<T>.OnError Method

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);
}


.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft