Error-handling function that indicates the use of the command function within a custom *error* handler
Supported Platforms: Windows and Mac OS
(*push-error-using-command*)
No arguments.
Type: T
A value of T is returned.
A call to *push-error-using-command* should be made after you define a custom *error* handler function that contains the use of the command function.
When using *push-error-using-command*, you are limited to accessing only global variables and none of the local variables defined within the function where the error occurred from your custom *error* handler. If access to the local variables is required, replace any instances of the command function with command-s function and call *push-error-using-stack* instead.
The following example demonstrates the use of the *push-error-using-command* function.
(defun my_err (err_msg) (if (/= err_msg "Function cancelled") (prompt (strcat "\nError: " err_msg)) ) (command "._undo" "_e") (command "._U") (setq *error* olderr) (princ) ) (defun myUtil (key / ) (setq olderr *error* *error* my_err) (*push-error-using-command*) ; Indicate use of Command function instead of Command-s ; in the custom error handler (command "._undo" "_group") ; The following will not be executed in this sample, but is good ; framework for setting up your own error handlers (/ 1 0) ; Call a function with incorrect values to trigger the custom error handler ; Remove when setting up your code ;; Perform your tasks here (command "._undo" "_e") (setq *error* olderr) ; Restore old *error* handler (*pop-error-mode*) ; End the use of *push-error-using-command* )
After loading the sample code, enter (myutil “String”) at the Command prompt to enter the error handler.