guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

read errors


From: Han-Wen Nienhuys
Subject: read errors
Date: Mon, 5 Aug 2002 01:21:48 +0200

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   |   address@hidden   |   http://www.cs.uu.nl/~hanwen 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]