- epExecuteProcedureOverall constant
ExceptionChangeParameter (Function) In french: ExceptionChangeParamètre Configures the automatic behavior that will be implemented if an exception occurs in the current process. The previous behavior can be restored by ExceptionRestoreParameter. Syntax
ExceptionChangeParameter(<Behavior to implement> [, <Parameter>])
<Behavior to implement>: Integer constant Behavior to implement: | | epCode | Standard operating mode of exceptions.
Runs:- the WHEN EXCEPTION process
- the automatic management of exceptions.
| epExecuteProcedure | Runs the procedure specified as parameter.
This procedure must return one of the following constants:- opEndProcess: Gives control back to the user.
- opEndProgram (by default): The application is stopped.
- opRelaunchProgram: Stops and restarts the application.
| epExecuteProcedureOverall | Executes the procedure passed as parameter, when used in the project initialization code. The procedure is called if no local exception process is active.
The procedure is active in the execution context (project, external stand-alone component, internal stand-alone component). If there is no procedure in the current context, the procedure is searched in the parent context recursively, up to the application level.This procedure must return one of the following constants: - opEndProcess: Gives control back to the user.
- opEndProgram (by default): The application is stopped.
- opRelaunchProgram: Stops and restarts the application.
Remarks: - Each call replaces the previously specified procedure.
- In most cases, the procedure allows writing the details of the problem encountered to a log file.
| epGotoCaseException | Runs the code defined by: CASE EXCEPTION: | epResult | Exits from the current process and returns the value specified as parameter. The exception is not propagated. | epReturn | Ends the current process and does not propagate the exception |
<Parameter>: Optional parameter Optional parameter depending on the selected behavior. Remarks epExecuteProcedureOverall constant The epExecuteProcedureOverall constant is used to handle exceptions in the entire project. Reminder: to handle exceptions globally in the project, you can use the WHEN EXCEPTION block in the project initialization code. If the WHEN EXCEPTION process is declared in the project initialization code, it is valid for any error that occurs in the project. For more details, see General exception mechanism. Calling ExceptionChangeParameter with the epExecuteProcedureOverall parameter in the project initialization code allows you to specify the WLanguage procedure to call in case of exception. The specified procedure is called if no local exception process is enabled. Example: This is the call in the project initialization code:
ExceptionChangeParameter(epExecuteProcedureOverall, _HandleGlobalException)
The WLanguage code automatically calls the _HandleGlobalException global procedure if an exception occurs in the project. By using a global exception process for the entire project, it is possible to: - generate a dump file with dbgSaveDebugDump,
- send an email to the application developer with the dump file (or send the dump via FTP),
- show an error to the end user and suggest to restart the application.
Example:
PROCEDURE _HandleGlobalException() sFile is string sFile = fTempPath() + ["\"] + "Dump.wdump" // Saves a dump file dbgSaveDebugDump(sFile) // Opens the error window Open(WIN_Error, ExceptionInfo(errFullDetails), sFile) // In all cases, // close the program RESULT opEndProgram
The global procedure can be shared and reused in multiple projects. Business / UI classification: Neutral code
This page is also available for…
|
|
|
|