CachedException class

Used by a cache to report a problem with an original cause that may have occurred in the past as part of a separate operation.

Inheritance hierarchy

System.Object
  System.Exception
    Microsoft.SharePoint.Publishing.CachedException

Namespace:  Microsoft.SharePoint.Publishing
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)

Syntax

'Declaration
<SerializableAttribute> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class CachedException _
    Inherits Exception
'Usage
Dim instance As CachedException
[SerializableAttribute]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class CachedException : Exception

Remarks

For some caching strategies, it is advantageous to cache both the successfully fulfilled requests and the requests that failed due to an exception. The original exception is stored by the cache and rethrown when subsequent requests are made for the same object. Reusing the original exception object has some disadvantages: for example, the StackTrace property will be overwritten, the caller may attempt to handle the same problem twice, and there is no way to track the context where the original error occurred.

The CachedException class solves these problems by encapsulating the shared object as its InnerException property, and tracking additional details such as the timestamp and correlation ID for the original HTTP request.

For example, if the taxonomy navigation system encounters an error when it is trying to read a TermSet object into the taxonomy navigation cache, subsequent attempts to fetch the object will throw CachedException instances instead of reattempting the operation.

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See also

Reference

CachedException members

Microsoft.SharePoint.Publishing namespace

Microsoft.SharePoint.Publishing.Navigation.TaxonomyNavigation