Jump to content
LosGirk

On error checking...

Recommended Posts

LosGirk

Is it necessary to put error checking in a program that doesn't change any variables? In other words, does it do more than just the resetting of user settings if a cancel/escape occurs? Thanks

Share this post


Link to post
Share on other sites
LosGirk

Is there anybody out there?

Share this post


Link to post
Share on other sites
neophoible

You don't have to do error checking. It is up to you. However, if the program can go wrong, it helps to have the error checking instead of just crashing or returning nothing, leaving the user confused and frustrated.

Share this post


Link to post
Share on other sites
LosGirk

Alright thanks neophoible,

So if I'm hearing you right, it's good practice to at least have the "An error occurred, user settings reset" line so as to not leave someone hanging and just good cleanly courteousness. Thanks for stepping up.

 (princ  "\nAttention! An error has occurred!") 
   (princ  "\nFWTCAD  RCALC now restoring the user enviroment.")

 

8)

Share this post


Link to post
Share on other sites
hmsilva

Error handling,

is not only to reset system variables, is advisable to use an error handling function whenever we access an external file (txt, xls, ...) to open, to read or to write, to ensure that the file is properly closed on failure, if not, the external file will remain marked as "opened" and to access that file again, you will have to close the AutoCAD session and start a new one...

The same is applicable in ObjectDBX and other objects created, to release objects on error...

 

HTH

Henrique

Share this post


Link to post
Share on other sites
LosGirk

Thank you hmsilva

Share this post


Link to post
Share on other sites
hmsilva

You're welcome, LosGirk

 

 

Henrique

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×