Error Handling
Microsoft Provisioning Framework (MPF) supports standard error handling in the form of Provisioning Schema::try and Provisioning Schema::catch elements in the Provisioning Schema. Include try and catch nodes in any Procedures [HMC SDK] that requires error handling. Every try node must have one corresponding catch node.
During request execution, procedures in the catch node attempt to handle any errors thrown by the try node. If all catch procedures return successfully, the error is considered handled and execution continues. If there are nested catch blocks, errors are propagated outward starting from the innermost block. If the transaction fails, the Provisioning Engines [HMC SDK] rolls back the transaction and returns an error to the caller in the form of an Provisioning Schema::errorContext node.
MPF propagates unhandled exceptions to COM+, which in turn kills the application and reports the event in the Windows event log. The event log also displays the call stack that caused the exception.
When you write a procedure, include the set of errors it throws. This information will assist namespace writers and others who need to know whether some errors should be handled differently or remapped using a Provisioning Schema::catch node. MPF raises one error at a time, and each error code maps to one message. Using the Error Provider, you can remap low-level errors (such as "Object does not exist on the server") to contextual errors (such as "Organization not provisioned").