[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with the condition system



Date: Mon, 2 Sep 91 11:27+0100
From: Vincent Keunen <keunen@milou.nrb.be>
Subject: Problem with the condition system
To: SLUG@WARBUCKS.AI.SRI.COM
Message-ID: <19910902102730.4.KEUNEN@milou.nrb.be>
Character-Type-Mappings: (1 0 (NIL 0) (NIL :ROMAN NIL) "CPTFONT")
Fonts: CPTFONT, CPTFONT
          
I am building a pathname from various elements, some of which are
sometimes NIL.  In these cases, the pathname looks like
"m:>nrbr01>NIL>ethernet>..." which I would like to avoid.  Therefore I
figured I could use the new condition system (I know it's not a stable
standard yet, but I'd like to see how it works).
 
I planned on testing each element for its "NIL-ity" and delare an error
when it is NIL (with cerror).  Therefore I need to create a new condition
(eventually inheriting from file-error).  Here is what I use (very close
to the example of page 900 of cltl2 - I'm glad I don't have to
*pronouce* that!) to define the condition "1pathname-component-is-nil-error0":1 
 
(future-common-lisp:define-condition pathname-component-is-nil-error ()
  (cisco-name interface-name interface-number)
  (:report
    (lambda (condition stream)
      (clos::with-slots (cisco-name interface-name interface-number)
			condition
	(format stream
		"A pathname cannot be constructed because some of its components are null.~@
                 The components are :~&  Cisco name : ~a~&  Interface name : ~a~&  Interface number : ~a"
		cisco-name interface-name interface-number)))))
 
0Then to test it, I create the error:
 
1(future-common-lisp:cerror
  "Skip creating the file and loose these statistics."
  'pathname-component-is-nil-error
  :cisco-name "nrbr01"
  :interface-name "Ethernet"
  :interface-number nil)
 
0... but I'm thrown in the debugger :
 
Error: Flavor PATHNAME-COMPONENT-IS-NIL-ERROR does not handle the init keywords :CISCO-NAME, :I
NTERFACE-NAME, :INTERFACE-NUMBER
While in the function MAKE-INSTANCE  MAKE-CONDITION  FUTURE-COMMON-LISP:MAKE-CONDITION
 
MAKE-INSTANCE
   Arg 0 (SYS:FLAVOR-NAME): PATHNAME-COMPONENT-IS-NIL-ERROR
   Rest arg (FLAVOR::INIT-OPTIONS): (:CISCO-NAME "nrbr01" :INTERFACE-NAME "Ethernet" ...)
s-A, :    Ignore the unhandled init keywords.
s-B, :    Return to Breakpoint ZMACS in Editor Typeout Window 1
s-C:           Editor Top Level
s-D:           Restart process Zmacs Windows

 
 
So my questions are:
 
1- Does the condition system implemented by Symbolics follow cltl2
(namely is it based on clos or still on flavors as this error message
suggests)?
 
2- Or is there a point I missed?
 
3- I must admit I don't really understand well the various aspects of
the condition system and how they relate together (signal, error,
condition).
 
Has anybody any useful insights?
 
Thanks
 
Vincent Keunen
keunen@nrb.be