[plt-scheme] raise error

From: Robby Findler (robby.findler at gmail.com)
Date: Mon Jan 29 20:33:13 EST 2007

Probably you wanted to write:

(error 'my-function "this is the message: ~s ~s" (list 'a 'value)
(vector 'another 'value))

That is, pass a symbol as the first argument to error and you should
get the behavior you intend.

(Also, you probably want to use the error-print-handler, rather than
write + exn-message).


On 1/29/07, Rainer Gross <rainer_gross at gmx.net> wrote:
> Hello there!
> I am using the (error str v ...) function to raise exceptions in
> error cases. But I wonder about the result when i print the error
> message.
> The following is the result in the interaction window of DrScheme:
>  > (with-handlers ([exn? (lambda (exn) (write (exn-message exn)))])
>    (error "First part" "second part"))
> "First part \"second part\""
> I would have had expected:
> "First part second part"
> Why is it that the second and any subsequent strings are escaped? It
> seams that all parameters following the initial String are inserted
> into this string and not concatenated as described in the
> documentation. Only non string values are really concatenated.
> Is this a known problem, is there something I am doing wrong or I
> misinterpret the documentation. Is there a better way to do this?
> Mostly the error text is somthing like the following: (error "The "
> limit-type "was exceeded by" anything) where the symbols resolve to
> symbols, numbers or strings.
> Any help would be appreciated.
> Best Regards,
> Rainer
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.