unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Han-Wen Nienhuys <hanwen@cs.uu.nl>
Subject: read errors
Date: Mon, 5 Aug 2002 01:21:48 +0200	[thread overview]
Message-ID: <15693.46860.769864.876889@blauw.xs4all.nl> (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


             reply	other threads:[~2002-08-04 23:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-04 23:21 Han-Wen Nienhuys [this message]
2002-08-05 18:02 ` read errors 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15693.46860.769864.876889@blauw.xs4all.nl \
    --to=hanwen@cs.uu.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).