unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Parsing eval errors
@ 2009-06-06 16:53 Chris Dennis
  2009-06-11 21:57 ` Neil Jerram
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Dennis @ 2009-06-06 16:53 UTC (permalink / raw)
  To: Guile Users

Hello Guilers

Is there some code anywhere for parsing the error information caught 
from local-eval?

The following code is the best I have come up with so far, but the 
messages it produces aren't pretty:

   (define (error-handler key . args)
     (display (object->string key))
     (for-each (lambda (arg)
                 (display (_ ", arg="))
                 (display (object->string arg)))
               args)
     (newline))

   (catch #t (local-eval s-expr (the-environment))
             error-handler)

regards

Chris
-- 
Chris Dennis                                  cgdennis@btinternet.com
Fordingbridge, Hampshire, UK




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Parsing eval errors
  2009-06-06 16:53 Parsing eval errors Chris Dennis
@ 2009-06-11 21:57 ` Neil Jerram
  2009-06-14 14:40   ` Chris Dennis
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Jerram @ 2009-06-11 21:57 UTC (permalink / raw)
  To: Chris Dennis; +Cc: Guile Users

Chris Dennis <cgdennis@btinternet.com> writes:

> Hello Guilers

Hi Chris,

> Is there some code anywhere for parsing the error information caught
> from local-eval?
>
> The following code is the best I have come up with so far, but the
> messages it produces aren't pretty:
>
>   (define (error-handler key . args)
>     (display (object->string key))
>     (for-each (lambda (arg)
>                 (display (_ ", arg="))
>                 (display (object->string arg)))
>               args)
>     (newline))
>
>   (catch #t (local-eval s-expr (the-environment))
>             error-handler)

There's a routine called `handle-system-error' in ice-9/boot-9.scm,
which the REPL uses for printing out "system" errors.  "System" errors
roughly means those generated from the internals of libguile, plus any
application errors that were originated by calling the procedures that
libguile provides for error reporting (node `Error Reporting' in the
manual).

Hope that's some help...

    Neil




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Parsing eval errors
  2009-06-11 21:57 ` Neil Jerram
@ 2009-06-14 14:40   ` Chris Dennis
  2009-06-14 20:47     ` Neil Jerram
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Dennis @ 2009-06-14 14:40 UTC (permalink / raw)
  To: Neil Jerram; +Cc: Guile Users

Neil Jerram wrote:
> Chris Dennis <cgdennis@btinternet.com> writes:
> 
>> Hello Guilers
> 
> Hi Chris,
> 
>> Is there some code anywhere for parsing the error information caught
>> from local-eval?
>>
>> The following code is the best I have come up with so far, but the
>> messages it produces aren't pretty:
>>
>>   (define (error-handler key . args)
>>     (display (object->string key))
>>     (for-each (lambda (arg)
>>                 (display (_ ", arg="))
>>                 (display (object->string arg)))
>>               args)
>>     (newline))
>>
>>   (catch #t (local-eval s-expr (the-environment))
>>             error-handler)
> 
> There's a routine called `handle-system-error' in ice-9/boot-9.scm,
> which the REPL uses for printing out "system" errors.  "System" errors
> roughly means those generated from the internals of libguile, plus any
> application errors that were originated by calling the procedures that
> libguile provides for error reporting (node `Error Reporting' in the
> manual).
> 
> Hope that's some help...
> 
>     Neil

Hello Neil

Thank you for your reply.  I couldn't get handle-system-error to work, 
but reading about it led me to display-error, which does what I want.

cheers

Chris

-- 
Chris Dennis                                  cgdennis@btinternet.com
Fordingbridge, Hampshire, UK




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Parsing eval errors
  2009-06-14 14:40   ` Chris Dennis
@ 2009-06-14 20:47     ` Neil Jerram
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Jerram @ 2009-06-14 20:47 UTC (permalink / raw)
  To: Chris Dennis; +Cc: Guile Users

Chris Dennis <cgdennis@btinternet.com> writes:

> Thank you for your reply.  I couldn't get handle-system-error to work,
> but reading about it led me to display-error, which does what I want.

Excellent!  (If by a roundabout route.)

    Neil




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-14 20:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-06 16:53 Parsing eval errors Chris Dennis
2009-06-11 21:57 ` Neil Jerram
2009-06-14 14:40   ` Chris Dennis
2009-06-14 20:47     ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).