Artificially triggers the security mechanism of WLanguage by throwing an exception. Then, this exception can be processed by an exception code written for this purpose. The exceptions are thrown in the WLanguage code only (and not in the framework).
Used in a Webservice, this function allows you to:
- stop the current process,
- return an error to the external application that uses the Webservice via the standard SOAP protocol.
In the XML code returned by the Webservice, the error message is returned in the "faultstring" tag. The error number is not returned in a specific tag, it is contained in the text of the full error details found in the "detail" tag.
Caution: When consuming this Webservice in a WINDEV, WEBDEV or WINDEV Mobile application, the error must be retrieved by ErrorInfo (and not by ExceptionInfo).
// -- Window global declarations
// According to the exception code
// Process the exception 1
CASE 1: ...
// Process the exception 2
CASE 2: ...
// -- Click of Button1
// Throw an exception 1
// -- Click of Button2
// Throw an exception 2
ExceptionThrow(<Error number> [, <Message>])
<Error number>: Integer or constant
Number of the error to throw. This number (included between 1 and 1000) is defined by the developer.
<Message>: Optional character string
Message associated with the error.
Retrieving information about the exception
The information about the exception is retrieved by ExceptionInfo
- ExceptionInfo(errCode) is used to retrieve the number of the exception.
- ExceptionInfo(errMessage) is used to retrieve the message.