Base de Conocimientos Técnicos

Cannot clear the error if an XML job fails

Hint Ref: 020801080010
Hint Date: 08/01/2008

Hint Details:

PROBLEM: If a job, run from the XML Jobs menu, fails and results in an error, then this error cannot be cleared and the only way forward is to use the Windows Task Manager to End the Spaceman.exe task.

 

SOLUTION: The solution to this issue is to handle the error yourself using the <Block></Block>, <Catch></Catch> method.

Simply contain the main body of the script with the <Block> section and in the event of an error, execution will immediately jump to the first line of the <Catch>.

However, please note that it is now up to you to display the error to the user and the option not to do so can be useful if the XML job is to be run unattended.  The <Catch> could even email details of the error to the nominated users.

The error message is contained in the variable 'Exception'.

Example:

<Job autoclose="YES">
 <Block>
   <!-- Inside the 'Block' goes the XML job that was inside the 'Job'-->
   <!-- On an error, execution jumps to the first line inside the 'Catch'-->
   <!-- The actual error message is automatically stored in a variable called 'Exception'-->
   <Parameters>
     <Parameter name="area"/>
     <Parameter name="areaname"/>
   </Parameters>
 </Block>
 <Catch>
   <Rollback/>
   <SetVariable name="extramess">
     <Writeln/>
     <Writeln/>
     <Writeln>Please Report this error to RADical Systems on +44 1483 238730.</Writeln>
     <Writeln/>
     <Writeln>To aid our Support Staff please take a screen shot and email this along</Writeln>
     <Writeln>with your contact details and a brief description of what you were doing to:</Writeln>
     <Writeln/>
     <Writeln>support@radicalsys.com</Writeln>
     <Writeln/>
     <Writeln>Thank you.</Writeln>
   </SetVariable>
   <MessageDialog text="{Exception}{extramess}"/>

   <SendEmail subject="Automatic Space Manager Error Report">
     <EmailRecipients>
       <Writeln>support@radicalsys.com,rip@radicalsys.com</Writeln>
     </EmailRecipients>
     <EmailBody>
       <Writeln>Areaname: {areaname}</Writeln>
       <Writeln/>
       <Writeln>An XML Job terminated abmormally with the following error:</Writeln>
       <Writeln/>
       <Writeln>{Exception}</Writeln>
     </EmailBody>
   </SendEmail>
 </Catch>
</Job>

(Please Note: This Procedure can be destructive and should only be used by Advanced Users.  RADical Systems (UK) Limited or its Partners cannot be held responsible, in anyway, for any consequence of using this or any other Database Function, Procedure or SQL command.  Responsibility resides solely with the user.  

IT IS HIGHLY RECOMMENDED THAT A FULL AND VALID SPACE MANAGER DATABASE BACKUP IS TAKEN AND VERIFIED AS VALID BEFORE MAKING ANY CHANGES TO THE DATABASE.)