[Openmcl-devel] error format
gb at clozure.com
Sun Jan 15 17:58:54 PST 2006
There are functions and variables in CL that control whether something
prints "readably" or not (where "readably" means that you could expect
to do something like:
(read-from-string (format nil "..." ...)
and read back something EQUAL to what was printed if that's possible,
or choke on #< if it isn't.)
When it isn't important to print "readably" (for READ's benefit), the
result is often more human-readable.
There are -lots- of CL printer-control variables (*PRINT-ESCAPE*,
*PRINT-READABLY*, *PRINT-ARRAY*, ...) that can be bound/set to
exercise fine-grained control over the printing process, and there are
convienient functions (PRIN1/PRINC) and idioms (format stream "~s"
...)/(format stream "~a") that allow you to choose between "appropriate
for presentation to a human reader" and "appropriate for attempting
to re-READ the output."
If a CONDITION is printed with PRIN1/~S/something that binds
*PRINT-ESCAPE* true, you'll get the #<this is a condition of some
type> printed representation; if it's printed with
PRINC/~A/*PRINT-ESCAPE* false, its "condition reporter" function (the
function specified in the :REPORT clause of DEFINE-CONDITION) prints
what's usually a more human-readable/descriptive message.
Is that what you were asking ?
On Sun, 15 Jan 2006, Kilian Sprotte wrote:
> I have a simple question and would be very happy to get a little clue.
> I am attempting to catch errors myself and print out an error message.
> So the simplest approach would be something like this:
> (handler-case (/ 1 0) (error (c) (print c)))
> But what I actually want is a printout of the error message
> that openmcl will give if there is no custom handling.
> -DIVISION-BY-ZERO detected
> -performing 'TRUNCATE on (1 0)
> instead of
> -#<DIVISION-BY-ZERO #x8C1F3C6>
> Although I can do it for simple errors by using
> simple-condition-format-control and -arguments,
> I wonder what to do with the rest...
> There must be some function in CCL, no?
> Kilian Sprotte
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel