com.microsoft.tfs.core.exceptions.mappers
Class TECoreExceptionMapper

java.lang.Object
  extended by com.microsoft.tfs.core.exceptions.mappers.TECoreExceptionMapper
Direct Known Subclasses:
BuildExceptionMapper, CatalogExceptionMapper, ClassificationExceptionMapper, GroupSecurityExceptionMapper, LinkingExceptionMapper, LocationExceptionMapper, RegistrationExceptionMapper, ServerStatusExceptionMapper, VersionControlAdminExceptionMapper, VersionControlExceptionMapper, VersionControlIntegrationExceptionMapper, WorkItemExceptionMapper

public abstract class TECoreExceptionMapper
extends java.lang.Object

Basic exception mapper.

Exception mappers provide a static method that takes an exception thrown from a lower level (SOAP library, for instance) that must be mapped into a TFS domain-specific exception before it leaves core. This practice prevents exception types from leaking upwards to clients without the proper TFS client context.

A mapper is needed because SOAPService's methods may throw SOAPFault exceptions when web service methods are invoked. Because TFS formats the data inside a SOAPFault differently for each type of web service, core clients must transform this exception into a more specific type of exception to give to the caller. Applications using core will then receive more precise exception types that are easier to filter on and format for display. These mapper classes provide this functionality with client-specific knowledge.

You can't call map(RuntimeException) directly on this class, so call it on the appropriate client-specific class in this package instead.

Since:
TEE-SDK-10.1
Thread-safety:
immutable

Constructor Summary
TECoreExceptionMapper()
           
 
Method Summary
protected static java.lang.RuntimeException map(java.lang.RuntimeException e)
          Takes any Exception and returns a more specific TECoreException that can be thrown in its place, if a more specific type is known.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TECoreExceptionMapper

public TECoreExceptionMapper()
Method Detail

map

protected static java.lang.RuntimeException map(java.lang.RuntimeException e)
Takes any Exception and returns a more specific TECoreException that can be thrown in its place, if a more specific type is known. If no better class is known, the given exception is returned unaltered.

Parameters:
e - the Exception to map (find a more specific exception for). If null, null is returned.
Returns:
the most specific TECoreException that can be used in place of the given exception, or null if the given exception was null.


© 2015 Microsoft. All rights reserved.