May 22, 2020 Replies: 1 Hello, Sometimes you need to stop a piece of code and explain why you have to do it. A good way is to raise an exception and to give information about the reason why. This little class offers you a pratical way to do this : 1) Add the class to your project Code: Copy Public fException As clsException Declare the instance in the starter module is a good idea Code: Copy Starter.fException.raise("Main","fButton_Click",1,$"Too big : (${i})"$,True) You pass the module, the method, an erorr number, an error message and say if you want to log the exception. Code: Copy wait for (fXUI.MsgboxAsync(Starter.fException.info,"Exception")) msgbox_result(result As Int) Class and example in the zip archive SPSP Attachments exception.zip exception.zip 9.8 KB · Views: 542 Click to expand...
Hello, Sometimes you need to stop a piece of code and explain why you have to do it. A good way is to raise an exception and to give information about the reason why. This little class offers you a pratical way to do this : 1) Add the class to your project Code: Copy Public fException As clsException Declare the instance in the starter module is a good idea Code: Copy Starter.fException.raise("Main","fButton_Click",1,$"Too big : (${i})"$,True) You pass the module, the method, an erorr number, an error message and say if you want to log the exception. Code: Copy wait for (fXUI.MsgboxAsync(Starter.fException.info,"Exception")) msgbox_result(result As Int) Class and example in the zip archive SPSP
B Bob Spielen Active Member Licensed User Longtime User May 22, 2020 #2 Really nice, thanks for sharing!