Skip to content

A macro to allow ignoring exceptions #53

@James4Ever0

Description

@James4Ever0

For example, running the following code in hy:

(raise (Exception "some exception"))
(print "skip the above line")

Skipping the exception is not possible in hy, currently. However, in clisp, we can do this with commandline clisp -on-error debug test.lisp:

; inside test.lisp
(print "val")
(/ 1 0)
(format t "Hello, World!")

It offers option to restart on exactly the line of division by zero and does not re-execute the line (print "val"), without aborting the whole process.

clisp -on-error debug test.lisp

"val" 
*** - /: division by zero
The following restarts are available:
SKIP           :R1      skip (/ 1 0)
RETRY          :R2      retry (/ 1 0)
STOP           :R3      stop loading file test.lisp
Break 1 [3]>  ; type whatever you want here, execute new code, 
              ; reload file, define new function, macro, even changing 
              ; the behavior of the "/" operator, to fix the error and continue

This feature is provided as clisp's command line argument. I wonder if hy interpreter can do the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions