Share via


Provisioning Schema::try

Element that wraps procedure steps and passes any errors to the corresponding Provisioning Schema::catch block. This element is part of the provisioning schema of Microsoft Provisioning Framework (MPF).

Arguments

Input Argument Description

Provisioning Schema::catch

(minOccurs="0" maxOccurs="*")

Provisioning Schema::execute

(minOccurs="0" maxOccurs="*")

Provisioning Schema::queue

(minOccurs="0" maxOccurs="*")

Provisioning Schema::select

(minOccurs="0" maxOccurs="*")

Provisioning Schema::transform

(minOccurs="0" maxOccurs="*")

try

(minOccurs="0" maxOccurs="*")

Remarks

Provisioning requests that use try-catch Error Handling have try and catch nodes in the procedure. Each procedure step that requires error handling is wrapped in a try node. If an error occurs when a provisioning engine executes the try node, the engine executes the corresponding catch node and passes the Provisioning Schema::errorContext node to all its procedures. If the catch node successfully responds to the error, the procedure continues to execute. Otherwise, the engine initiates rollback.

The try-catch blocks can be nested to any depth. However, a try node must always be followed by a catch node.

Sample Code

Example XML Request

<request> 
  <data /> 
  <context> 
    <clientContext clientTransactionId="53367B03-63D3-44ae-B8AD-C1E57E876E70" /> 
  </context> 
  <procedure> 
    <try> 
      <execute namespace="Error Provider" procedure="SetError"> 
        <executeData> 
          <hr>0x82101391</hr> 
          <desc>The username already exists in the database</desc> 
        </executeData> 
        <after source="executeData" destination="data" /> 
      </execute> 
    </try> 
    <catch> 
      <execute namespace="Error Provider" procedure="TranslateProvisioningError"> 
        <executeData> 
          <errorMessageContext>adduser</errorMessageContext> 
          <locId>1033</locId> 
        </executeData> 
        <after source="executeData" destination="data" /> 
      </execute> 
    </catch> 
  </procedure> 
</request>

Applies To

Provisioning Schema; Provisioning Schema::catch; Provisioning Schema::procedure; try

See also

Tasks

Provisioning Schema::catch
Provisioning Schema::procedure
Provisioning Schema::catch
Provisioning Schema::execute
Provisioning Schema::queue
Provisioning Schema::select
Provisioning Schema::transform