Share via


ValidationException Class

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

The exception that is thrown on validation when using an invalid value.

Namespace:  Microsoft.CommerceServer.Catalog
Assembly:  Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class ValidationException _
    Inherits CatalogException
'Usage
Dim instance As ValidationException
[SerializableAttribute]
public class ValidationException : CatalogException
[SerializableAttribute]
public ref class ValidationException : public CatalogException
public class ValidationException extends CatalogException

Remarks

All catalog exceptions, including the ValidationException are derived from the CatalogException class. When a validation is performed using invalid values, the ValidationException is thrown.

Examples

// Creates a property of the data type string and also specifies the maxlength.
internal CatalogProperty CreateProperty(string propertyName, CatalogDataType catalogDataType, int maxLength)
{
  CatalogProperty property = null;
  try
  {
    property = catalogContext.CreateProperty(propertyName, catalogDataType, maxLength);
  }
  // The property name is not valid
  catch (ValidationException ex)
  {
    Console.WriteLine(ex.Message);
  }
  // The Property already exists
  catch (EntityAlreadyExistsException ex)
  {
    string message = string.Format("The property {0} already exists", ex.EntityName);
    Console.WriteLine(message);
  }
  return property;
}

Inheritance Hierarchy

System..::.Object
  System..::.Exception
    Microsoft.CommerceServer.Catalog..::.CatalogException
      Microsoft.CommerceServer.Catalog..::.ValidationException
        Microsoft.CommerceServer.Catalog..::.InvalidObjectException

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

ValidationException Members

Microsoft.CommerceServer.Catalog Namespace