[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 4 questions about error conditions.
From: |
Richard Guenther |
Subject: |
Re: 4 questions about error conditions. |
Date: |
Thu, 27 Sep 2001 17:51:38 +0200 (CEST) |
On Thu, 27 Sep 2001, [ISO-8859-1] ??????(9) wrote:
>
> Hi, everyone.
>
> My program reads a guile expression from STDIN and evaluate it using
> gh_eval_str(). But if any user gives wrong expression (e.g. just ")"),
> gh_eval_str() prints error message like below and *terminates* my program:
>
> ERROR: In procedure read:
> ERROR: unexpected ")"
Thats expected behaviour. You need to catch the exception thrown. If
you just want to know wheter everything went ok, use
SCM result = gh_eval_str_with_catch((char *)str,
scm_handle_by_message_noexit);
(or gh_eval_file_with_catch) which will return #f if anything went
wrong, #unspecified otherwise (if I remember correctly).
Hope this helps, Richard.
--
Richard Guenther <address@hidden>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
The GLAME Project: http://www.glame.de/