Jump to content

create an on error resume (especific)


Recommended Posts

Posted

How to create in Visual Lisp an ON ERROR RESUME NEXT a specific block

in C# i use

try 
{
  COMMAND ERRO
}
catch
{
  // GO AHEAD , DONT BREAK
}

 

Thanks

Rodrigo

Posted

Look into using vl-catch-all-apply

 

Please remember to use code tags...

 

[highlight][noparse]

[/noparse][/highlight] Your code here [highlight][noparse]

[/noparse][/highlight]

Posted

Sorry, thought it was only for use in large codes, I will do next time.

 

Do you have a simple example of vl-catch-all-apply ?

The examples I found on google are as difficult to understand much.

 

Thanks

Rodrigo

Posted

Silly example:

 

(defun c:test ( / num result )
   (if (setq num (getint "\nChoose a number... just not zero: "))
       (progn
           (if (vl-catch-all-error-p (setq result (vl-catch-all-apply '/ (list 10.0 num))))
               (princ "\nI told you not to choose zero!")
               (princ (strcat "\n10 / " (itoa num) " = " (rtos result 2)))
           )
       )
   )
   (princ)
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...