Author Topic: Critical words in an AutoCAD error message.  (Read 1052 times)

0 Members and 1 Guest are viewing this topic.

glfiedler

  • Mosquito
  • Posts: 7
Critical words in an AutoCAD error message.
« on: February 05, 2022, 03:33:46 PM »
For a number of years I have used the following code in my *error* routine.  The code comes from Lee Mac's website where he addresses error handling.
http://www.lee-mac.com/errorhandling.html
Code: [Select]
(if (not (member msg '("Function cancelled" "quit / exit abort")))
            (princ (strcat "\nError: " msg))
It seems to work but then my lisp routines don't usually create errors! :2funny:
In another Swamp post https://www.theswamp.org/index.php?topic=57350.0 the *error* routine in the c:test that Lee provided used:
Code: [Select]
(if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
            (princ (strcat "\nError: " msg))
The two bits of code above will catch slightly different messages since they do not contain the same words.
My question to everyone is what words do you use to catch the error for the escape key or other deliberate way of exiting a routine that is not really an "error"?

Stefan

  • Bull Frog
  • Posts: 319
  • The most I miss IRL is the Undo button
Re: Critical words in an AutoCAD error message.
« Reply #1 on: February 05, 2022, 05:02:21 PM »
There is no reason to catch any of these messages, you could print any error message as well. But if esc is pressed, the user is aware of the action,  so printing the message is redundant. *exit* should be enough, I don't know where Cancel could come from, and Break is for back compatibility, or just remnant of the old days, DOS versions, when you could break the current command with ctrl+C.
I still use all of them, break, cancel, exit, but only because I'm lazy and I always copy paste the error function.

Edit: So I was wrong. "Function cancelled" comes from pressing ESC and "quit / exit abort" comes from using (exit) function in your code. As long as you don't intend to use it, *cancel* would be enough in *error* function.
« Last Edit: February 06, 2022, 08:13:28 AM by Stefan »

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: Critical words in an AutoCAD error message.
« Reply #2 on: February 06, 2022, 08:47:10 AM »
Excellent answer as always Stefan.

For completeness, "Application ERROR: Console break" will also be output when the user presses ESC within a grread loop without bit 8 set in the allkeys argument.

glfiedler

  • Mosquito
  • Posts: 7
Re: Critical words in an AutoCAD error message.
« Reply #3 on: February 06, 2022, 02:59:37 PM »
So that explains it! Thank you both for taking the time to answer my question.

d2010

  • Bull Frog
  • Posts: 326
Re: Critical words in an AutoCAD error message.
« Reply #4 on: February 07, 2022, 12:41:15 AM »
So that explains it! Thank you both for taking the time to answer my question.
Please you test the error/s inside thisLisp.
You will can compile your COLADD. to debug-version.lsp.

You play and fun, after you got any error, that moment, you type (getmypid)
 :opps:
Code - Auto/Visual Lisp: [Select]
  1. Main ideea is, you must compile yourLisp to Debug_version _jc_aro10.lsp?
  2.  
« Last Edit: February 08, 2022, 09:06:02 AM by d2010 »