Results 1 to 4 of 4

Thread: Questions on error trapping

  1. #1
    Active Member
    Join Date
    2008-02
    Location
    Toronto, On
    Posts
    59
    Login to Give a bone
    0

    Default Questions on error trapping

    Hey all!

    The common practice is to use :

    (setq TempErr *ERROR*) to store the current error trap in a variable for restoring it at the end of the function.

    And then use (setq *ERROR* CurrErrTrap) to point to the new error trap, which is defined elsewhere.

    I've been playing around with defining functions inside of other functions, and one of the things I tried was defining an *ERROR* function inside of another function, and adding *ERROR* to the scoped variable list. It seems to me that this gets around needing to use a temporary variable and needing to ensure that it gets reset at the end.
    Am I missing something? or is this actually clever?

  2. #2
    AUGI Addict
    Join Date
    2006-04
    Location
    (getpoint "Anywhere on the Enter Key =>")
    Posts
    1,160
    Login to Give a bone
    0

    Default Re: Questions on error trapping

    There are a plenty of threads in this forum.
    Have you done a search in this forum?
    You can see some of them are shown at the bottom of this page under "Similar Threads". And they give rich source on the the topic.
    Hope they help.

  3. #3
    Active Member
    Join Date
    2008-02
    Location
    Toronto, On
    Posts
    59
    Login to Give a bone
    0

    Default Re: Questions on error trapping

    I did search the forum for error trapping, and didn't find anything discussing my specific idea. The "Similar Threads" were helpful for unrelated tasks, but not the idea that I posted about.

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Questions on error trapping

    'Error trapping', or 'error handling' is a popular topic, and can be accomplished in more than one way.

    Defining a local *error* function, is just as effective as defining a separate function dependency. Using the IF, AND, OR, COND, and WHILE functions are also able to trap errors (among others).

    Just be careful to change variables back to their original value upon error/exit.

    Hope this helps!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. ACADDOC.LSP error trapping
    By jasonp in forum AutoLISP
    Replies: 3
    Last Post: 2014-03-18, 05:43 PM
  2. Error Trapping
    By jmcshane in forum AutoLISP
    Replies: 6
    Last Post: 2008-12-21, 02:56 AM
  3. Error Trapping
    By prose in forum AutoLISP
    Replies: 4
    Last Post: 2008-12-05, 10:02 PM
  4. If Statements & error trapping
    By planview in forum AutoLISP
    Replies: 0
    Last Post: 2006-05-29, 08:46 AM
  5. nested error trapping used incorrectly
    By Bob Eardley in forum AutoCAD General
    Replies: 5
    Last Post: 2005-09-14, 10:52 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •