PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

  • Example: Customizing the errors
HOnError (Example)
Example: Customizing the errors
WINDEVWEBDEV - Server codeUser code (UMC)AjaxHyper File 5.5OLE DB The following example is used to customize the management of errors with two procedures:
  • OnLockError(), which allows customizing lock errors
  • OnOtherError(), which allows customizing all the other types of errors
//------ Procedure to call when a lock error occurs
PROCÉDURE OnLockError()
 
IF YesNo( "A lock error occurred" + CR + ...
"Do you want to retry?") = True THEN
        // Retry the operation that failed
        RESULT opRetry
END
// Give control back to the user
RESULT opEndProcess
//------- Procedure to call for errors other than lock errors
PROCÉDURE OnOtherError()
 
SWITCH HError(hErrCurrent)
CASE 70015// Integrity error
// Process specific to the integrity errors
// for example, display the error with Error(HErrorInfo())
// end the current process
...
// Give control back to the user
RESULT opEndProcess
 
CASE 70100 // Lock error
// Process specific to the lock errors
// for example, display the error with Error(HErrorInfo())
// end the current process
...
// Give control back to the user
RESULT opEndProcess
 
CASE 70010// Duplicate error
// Process specific to the duplicate error
// for example, display the error with Error(HErrorInfo())
// end the current process
...
// Give control back to the user
RESULT opEndProcess
 
CASE 70700// Error of modification conflict
// Process specific to the errors of modification conflict
// for example, display the error with Error(HErrorInfo())
// end the current process
...
// Give control back to the user
RESULT opEndProcess
 
CASE 70710// 'Mandatory Value' error
// Process specific to the errors of mandatory value
// for example, display the error with Error(HErrorInfo())
// end the current process
...
// Give control back to the user
RESULT opEndProcess
 
CASE 70720// 'Indexing in progress' error
// Process specific to the 'indexing in progress' errors
// for example, display the error with Error(HErrorInfo())
// end the current process
...
// Give control back to the user
RESULT opEndProcess
 
CASE 70022// Password error
// Process specific to the password errors
// for example, display the error with Error(HErrorInfo())
// or reset the password for the relevant file
// with HPass(HErrorInfo(hErrFile), NewPassword)
// end the current process
...
// Give control back to the user
RESULT opEndProcess
END
//------- Customize the errors (in the initialization code of the project for example)
HOnError("*", hErrLock, "OnLockError")
HOnError("*", hErrIntegrity + hErrDuplicates + ...
hErrModify + hErrPassword, "OnOtherError")
//------- Add a record
// no need to check the return because if an error occurs,
// the addition will be retried or the process will be canceled
HAdd(CUSTOMER)
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment