PDA

View Full Version : Error Handling


whattaz13
2008-07-11, 04:11 PM
I'm looking for a some error handling. With a little luck and a lot of help from other peoples posts I got my list routine to work. Now that it's working I would like to add some error handling on not allowing xrefs to attach more that once. They attach fine but if I accidently attach one again it errors out. If any one could help that would be greatly appreciated. See attachment for the code...Thanks

Adesu
2008-07-15, 08:26 AM
Hi whattaz,
Do you mean error handling code like this

(defun c:test (/ *error* om otm opt)
(setq *error* myer)
(setq om (getvar "xxx"))
(setvar "xxx" 0)
(setq otm (getvar "yyy"))
(setvar "yyy" 1)

(setq opt (getstring t "\nPress Esc button to test error: "))
;*****PUT YOUR MAIN CODE HERE *******

(setvar "xxx" om)
(setvar "yyy" otm)
(setq *error* nil)
(princ)
)

(defun myer (msg)
(setvar "xxx" om)
(setvar "yyy" otm)
(setq att "*** Resetting system variable has been done ***")
(princ att)
)


I'm looking for a some error handling. With a little luck and a lot of help from other peoples posts I got my list routine to work. Now that it's working I would like to add some error handling on not allowing xrefs to attach more that once. They attach fine but if I accidently attach one again it errors out. If any one could help that would be greatly appreciated. See attachment for the code...Thanks

whattaz13
2008-07-16, 03:03 PM
Thanks Adesu, I might not fully understand you code. But I don't think that's it. If you look at my lsp code under the refnew command for example. That's where my error happens when I'm renaming the xref. I would like to detach the duplicated xref and then continue w/ the code.