* read errors
@ 2002-08-04 23:21 Han-Wen Nienhuys
2002-08-05 18:02 ` Marius Vollmer
0 siblings, 1 reply; 6+ messages in thread
From: Han-Wen Nienhuys @ 2002-08-04 23:21 UTC (permalink / raw)
I just added some friendly error messages to the reader. I haven't
committed it yet, though. -- I have the following comment now. Perhaps
someone can shed some light on the proper way to deal with errors?
/*
Give meaningful error messages for errors
We use the format
MESSAGE
This happened in ....
This is not standard GNU format, but the test-suite likes the real
message to be in front.
Hmmm.
Maybe this is a kludge? Perhaps we should throw (list EXPR FILENAME
LINENO COLUMNO), and have the exception handler sort out the error
message? Where does the handler live, what are the conventions for
the expression argument of the handler? How does this work for an
error message like
Backtrace:
In standard input:
4: 0* [list ...
standard input:4:1: While evaluating arguments to list in expression (list a b):standard input:4:1: Unbound variable: a
ABORT: (unbound-variable)
In any case, we would have to assemble that information anyway.
*/
#define INPUT_ERROR(port, message, arg) { \
char s[1024];\
int fn_found = SCM_STRINGP (SCM_FILENAME(port));\
char *fn = "";\
if (fn_found)\
fn = SCM_STRING_CHARS(SCM_FILENAME(port));\
snprintf (s, 1024, "%s\nThis happened in %s%s%s line %d column %d", message, \
fn_found ? "`" : "", \
fn,\
fn_found ? "'" : "", \
SCM_LINUM(port) + 1, SCM_COL(port) + 1); \
SCM_MISC_ERROR(s, arg); \
}
--
Han-Wen Nienhuys | hanwen@cs.uu.nl | http://www.cs.uu.nl/~hanwen
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: read errors
2002-08-04 23:21 read errors Han-Wen Nienhuys
@ 2002-08-05 18:02 ` Marius Vollmer
2002-08-05 18:16 ` Han-Wen Nienhuys
2002-08-05 23:15 ` Han-Wen Nienhuys
0 siblings, 2 replies; 6+ messages in thread
From: Marius Vollmer @ 2002-08-05 18:02 UTC (permalink / raw)
Cc: guile-devel
Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:
> This is not standard GNU format, but the test-suite likes the real
> message to be in front.
We need to change the test-suite, then.
> Maybe this is a kludge?
No, I think it's the best we can do with the present system.
> #define INPUT_ERROR(port, message, arg) {
Does this have to be a macro? I would like it better to be a function
(like scm_misc_error) and a thinly wrapped function (like
SCM_MISC_ERROR).
> snprintf (s, 1024, "%s\nThis happened in %s%s%s line %d column %d", message,
Can we use scm_simple_format here? That would avoid the 1024 limit
and would also feel more gentle since we don't need to poke into the
strings private parts.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: read errors
2002-08-05 18:02 ` Marius Vollmer
@ 2002-08-05 18:16 ` Han-Wen Nienhuys
2002-08-08 17:50 ` Marius Vollmer
2002-08-05 23:15 ` Han-Wen Nienhuys
1 sibling, 1 reply; 6+ messages in thread
From: Han-Wen Nienhuys @ 2002-08-05 18:16 UTC (permalink / raw)
Cc: guile-devel
marius.vollmer@uni-dortmund.de writes:
> > This is not standard GNU format, but the test-suite likes the real
> > message to be in front.
>
> We need to change the test-suite, then.
OK.
> > #define INPUT_ERROR(port, message, arg) {
>
> Does this have to be a macro? I would like it better to be a function
> (like scm_misc_error) and a thinly wrapped function (like
> SCM_MISC_ERROR).
I followed the SCM_MISC_ERROR template here. BTW, is misc-error some
kind of standard, or can we have 'read-error as a key?
> > snprintf (s, 1024, "%s\nThis happened in %s%s%s line %d column %d", message,
>
> Can we use scm_simple_format here? That would avoid the 1024 limit
> and would also feel more gentle since we don't need to poke into the
> strings private parts.
I'll check it out.
--
Han-Wen Nienhuys | hanwen@cs.uu.nl | http://www.cs.uu.nl/~hanwen/
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: read errors
2002-08-05 18:02 ` Marius Vollmer
2002-08-05 18:16 ` Han-Wen Nienhuys
@ 2002-08-05 23:15 ` Han-Wen Nienhuys
2002-08-06 12:02 ` Marius Vollmer
1 sibling, 1 reply; 6+ messages in thread
From: Han-Wen Nienhuys @ 2002-08-05 23:15 UTC (permalink / raw)
Cc: guile-devel
marius.vollmer@uni-dortmund.de writes:
> > Maybe this is a kludge?
>
> No, I think it's the best we can do with the present system.
ok.
> > snprintf (s, 1024, "%s\nThis happened in %s%s%s line %d column %d", message,
>
> Can we use scm_simple_format here? That would avoid the 1024 limit
> and would also feel more gentle since we don't need to poke into the
> strings private parts.
Yep, done, committed. (Scheme beginner, didn't know about
simple-format.)
--
Han-Wen Nienhuys | hanwen@cs.uu.nl | http://www.cs.uu.nl/~hanwen
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-08-08 17:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-04 23:21 read errors Han-Wen Nienhuys
2002-08-05 18:02 ` Marius Vollmer
2002-08-05 18:16 ` Han-Wen Nienhuys
2002-08-08 17:50 ` Marius Vollmer
2002-08-05 23:15 ` Han-Wen Nienhuys
2002-08-06 12:02 ` Marius Vollmer
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).