Lisp HUG Maillist Archive

failed to unread char: Wrong error type?

With our application built with LWW 5.0.2, I every now and then see
the following error:

  Condition: #<SIMPLE-ERROR 200D136B> #<COMM:SOCKET-STREAM 21A50FC7>:
  Failed to unread char.


Wouldn't it be better if this error was classified as a STREAM-ERROR or
COMM:SOCKET-ERROR? 

(Excerpt from the backtrace:

Call to SIGNAL (offset 809)
  CONDITIONS::DATUM     : #<SIMPLE-ERROR 200D136B>
  CONDITIONS::ARGUMENTS : NIL

Binding frame:
  CONDITIONS::*IN-SIGNAL-CATCH* : NIL

Catch frame: CONDITIONS::SIGNAL-CATCH

Binding frame:
  CONDITIONS::*BROKEN-ON-SIGNALS* : NIL

Call to (METHOD STREAM:STREAM-UNREAD-CHAR (STREAM:BUFFERED-STREAM T)) (offset 52)
  STREAM    : #<COMM:SOCKET-STREAM 21A50FC7>
  CHARACTER : :DONT-KNOW

)
-- 
  (espen)


Re: failed to unread char: Wrong error type?

Martin Simmons <martin@lispworks.com> writes:

> Maybe, but this error is usually caused by the code that calls it, not the
> stream itself.  It generally means that you called UNREAD-CHAR where the
> previous operation on the stream was not READ-CHAR.

Ah, thanks!

I think I may have some cases where READ-CHAR times out and 
UNREAD-CHAR is still called, that would explain it.
-- 
  (espen)


Updated at: 2020-12-10 08:45 UTC