This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: signal error from my smob_func


Sergey Dolin <dsa-ugur@chel.surnet.ru> writes:

> ML>what about:
> 
> ML>(let ((session (o:log "whatever")))
> ML>  (cond
> ML>   ((o:error? session)
> 
> I fought about it. It's not looked very nice. My aim - to make
> interface simple, but instead i make new "api" call "error" what Oracle
> had not have before...

uh...  you know that Guile has exception handling, don't you?  'cause
then you could make your `o:log' function throw the session object
instead of returning it:

(catch #t
  (lambda ()
    (let ((session (o:log "ivan" "bat'kovich" "ivanov")))
      ;; if we got here, all is fine
      (...)))
  (lambda (err-object)
    (cond
     ((o:session? err-object)
      (display (o:error err-object)))
     (else
      (throw err-object) ;propagate the error,
                         ;we don't know how to handle it here
    ))))

-- 
Look, would it save you all this bother if I just gave up and went mad now?
                -- Arthur Dent

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]