Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!oberon!nunki.usc.edu!sal32.usc.edu!nrouquet From: nrouquet@sal32.usc.edu (Nicolas Rouquette) Newsgroups: comp.lang.lisp Subject: KCL on SUNs --- si:universal-error-handler Message-ID: <1119@nunki.usc.edu> Date: 13 Jul 88 18:18:16 GMT Sender: news@nunki.usc.edu Lines: 95 The KCL doc suggests to redefine si:universal-error-handler if need be. The following code follows this advice to serve the purpose of the ignore-error function (comments signal the differences with the original handler). Question: Why is this code affected by saving the system and reloading the ========= saved image? (in-package 'system) (export 'ignore-error) (eval-when (compile) (proclaim '(optimize (safety 2) (space 3)))) (defvar *universal-error-handler-enable* nil "Controls si:universal-error-handler") (defvar *universal-error-name* nil "The name of the faulting error") (defun universal-error-handler (error-name correctable function-name continue-format-string error-format-string &rest args &aux message) ; there was (declare (ignore error-name)) (let ((*print-pretty* nil) (*print-level* 4) (*print-length* 4) (*print-case* :upcase)) (setq *universal-error-name* error-name) ; Added. (when *universal-error-handler-enable* ; (throw *quit-tag* *quit-tag*)) ; (terpri *error-output*) (cond ((and correctable *break-enable*) (format *error-output* "~&Correctable error(~a): " error-name) (let ((*indent-formatted-output* t)) (apply 'format *error-output* error-format-string args)) (terpri *error-output*) (setq message (apply 'format nil error-format-string args)) (if function-name (format *error-output* "Signalled by ~:@(~S~).~%" function-name) (format *error-output* "Signalled by an anonymous function.~%")) (format *error-output* "~&If continued: ") (let ((*indent-formatted-output* t)) (format *error-output* "~?~&" continue-format-string args)) ) (t (format *error-output* "~&Error(~a): " error-name) (let ((*indent-formatted-output* t)) (apply 'format *error-output* error-format-string args)) (terpri *error-output*) (setq message (apply 'format nil error-format-string args)) (if function-name (format *error-output* "Error signalled by ~:@(~S~).~%" function-name) (format *error-output* "Error signalled by an anonymous function.~%"))))) (break-level message) (unless correctable (throw *quit-tag* *quit-tag*))) (defun ignore-error (form) (let ((*universal-error-handler-enable* t) (*universal-error-name* nil)) (values (catch *quit-tag* (eval form)) *universal-error-name*))) Well, least is to say that error handling is wierd. ignore-error works fine but error handling in the other cases is affected by (si:save-system). Try at the top level to evaluate (1), the error report and the break loop are identical to the original kcl. Save the system, load the saved one, eval (1) again, *surprise*! Error(INVALID-FUNCTION): 1 is invalid as a function. ! "normal" error Error signalled by EVAL. ! message Error(ERROR): 8 is an illegal ihs index. ! <-- This is wierd. Error signalled by SYSTEM:UNIVERSAL-ERROR-HANDLER. ! Broken at SYSTEM:UNIVERSAL-ERROR-HANDLER. >>> The '8' is dependent on the expression that caused the error in the first place. Move the added lines in the (cond ...) clauses and it takes two si:save-system and reloads before this error occurs. Thank you for any help you may provide. Nick Rouquette.