Problems with catch-throw
Posted: Mon Mar 13, 2006 8:34 am
Seems that "catch" leads to unexpected results:
in the following example the 'if' always succeed,
both with the throw statement commented or not commented.
Moreover, the doc seems misleading.
In a paragraph is written :
Regards
Maurizio
in the following example the 'if' always succeed,
both with the throw statement commented or not commented.
Moreover, the doc seems misleading.
In a paragraph is written :
Few lines under is written :If an error occurs during evaluation, catch returns nil and stores the error message in symbol.
I'm working with vers 8.8.1, on Windows 2000.When a throw is executed during the evaluation of expr catch will return true and the throw argument will be stored in symbol
Regards
Maurizio
Code: Select all
(define (start)
(if (catch (do-work) 'errormsg)
(println "error occurred " errormsg)
(println "all goes well " errormsg)))
(define (do-work)
;; (throw "this is an error")
(println "i'm working"))
(start)
(exit)