../pvss.htm menu.gif basics.gif

throwError()

Passes a WinCC OA error to the internal error handler.

Synopsis

Parameters

Return value

Usually 0, in the event of an error -1.

Errors

Missing or incorrect arguments. If 0, "0 bytes" is returned, and if the value is less, then 0 an empty string is returned.

Description

The throwError() function passes an error variable to the WinCC OA system for further processing. By default, this results in the error being written to the PVSS_II.log file.

IconExample

This example gets a data point value via the dpGet function and checks if the get value is within a specific value range. The check is made via a switch/case structure. If the value is not within the value range, an own information message from an own catalog file is shown. The error (value is not within the value range) is catched via the makeError function and the information message is shown via the throwError function.

main{
   string cat, note1; /* Variable definitions for the makeError function */
   int prio,typ,co, dpG1;
   cat ="myError"; /* Definition of the catalog. The cat extension is not used.    
Only the name of the file. */

   prio=PRIO_INFO; /* Constant which defines the importance of the error of the    
information */

   typ =ERR_PARAM; //Type of the error
   co = 2; /* Sequence number of the information message from the own catalog   
"myError" */

   note1 = "The value should be between 2.0-2.2"; /* Additional information
that is shown. Is an optional parameter */

   errClass retError; /* errClass variable for the makeError function */
   string dp1 = "ExampleDP_Arg1.:_original.._value";
   float answ;
   DebugN("dpGet");
   dpG1=dpGet(dp1, answ);
   if(answ) <= 2.2)
     DebugN("Value within the value range:");
     
   else
   {
     DebugN("make error");
     retError=makeError(cat,prio,typ,co,note1);/* Function call. Catches the   
error */

     DebugN("throwError");
     throwError(retError); /* Outputs the error message */
    }
}

Member of

Errors

Availability

UI, CTRL, DP

See also

Top Of Page

 

V 3.11 SP1

Copyright ETM professional control GmbH 2013 All Rights Reserved