Error Handling

Error handling in a Commerce Server 2000 Web site revolves around the interaction of the Order Processing pipeline (OPP) with the OrderForm object, the pipeline objects (MtsPipeline, MtsTxPipeline, PooledPipeline, and PooledTxPipeline), and the MessageManager object.

The OrderForm object provides a detailed, in-memory summary of one or more shopping sessions, including merchant, user, and item information. You pass an initialized OrderForm object to the OPP by calling the Execute method of the pipeline object you are using.

As the OrderForm object goes through various stages of the OPP, the components in each stage read and write values to and from the OrderForm object.

For error processing, the critical members of the OrderForm object are its _Basket_Errors****and _Purchase_Errors collections. These collections store strings describing error conditions the OPP detects while processing other elements of the OrderForm object.

The OPP gets the error strings from the MessageManager object. The MessageManager object is the central repository of locale-based error messages for a site. Each message stored in the MessageManager object consists of a string that describes a given error condition, and a string identifier that uniquely identifies the message to the OPP. The MessageManager object creates the association between the string identifier and the string message through the AddMessage method that adds a message to the MessageManager object.

Although the string describing an error may vary from one site to the next, the string ID identifying a message does not change. For example, if the OPP is unable to validate a credit card in the OrderForm object, the pipeline attempts to retrieve the string associated with the message ID pur_bad_cc in the MessageManager object for the site. If the site developer has not associated a string with this message ID, the error condition is ignored. Otherwise, the OPP retrieves this message and writes it to the _Purchase_Errors collection in the OrderForm object. When the Execute method returns, you can examine this collection, and the strings in it can be used to provide site users with detailed descriptions of errors that occurred during order processing. For more information, see MessageManager Object.

See Also

Error Levels


All rights reserved.