Arc Forumnew | comments | leaders | submitlogin
a details that avoids double-quoting string error messages
2 points by CatDancer 6307 days ago | 2 comments
Here's a version of details that avoids double-quoting the error message, if it is already a string:

  (xdef 'details (lambda (c)
                   (let ((m (exn-message c)))
                     (if (string? m)
                         m
                         (write-to-string m)))))

  arc> (on-err details (fn () (/ 1 0)))
  "/: division by zero"
  arc>


1 point by ryantmulligan 6306 days ago | link

Don't you sometimes want to get a double quoted representation of a string?

-----

1 point by CatDancer 6306 days ago | link

In arc0,

  arc> (on-err details (fn () (/ 1 0)))
  "\"/: division by zero\""
can you give me an example of when you'd want that?

-----