From: David Kastrup <dak@gnu.org>
Date: Sun, 15 Jun 2014 12:31:48 +0000 (+0200)
Subject: Issue 3954: Report bad return values in user-readable form
X-Git-Tag: release/2.19.9-1~18
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7260be120168a6e0edc4472dce7f107ad4adb08f;p=lilypond.git

Issue 3954: Report bad return values in user-readable form

An error message like

  markup-def.ly:11:20: error: music function cannot return
  (#<procedure line-markup (layout props args)> (Test))

is not really user-readable.  At the price of some possible ambiguity,
using a LilyPond syntax form like

  markup-def.ly:11:20: error: music function cannot return \markup \line { Test}

is quite preferable.
---

diff --git a/scm/ly-syntax-constructors.scm b/scm/ly-syntax-constructors.scm
index 2712fc21f3..73e871686e 100644
--- a/scm/ly-syntax-constructors.scm
+++ b/scm/ly-syntax-constructors.scm
@@ -64,7 +64,8 @@
           (if good
               (ly:parser-error parser
                                (format #f (_ "~a function cannot return ~a")
-                                       (type-name pred) m)
+                                       (type-name pred)
+                                       (value->lily-string m parser))
                                loc))
           (and (pair? (car sig)) (cdar sig))))))