changeset 573:5474b55b3071

More informative error output
author Chris Cannam
date Tue, 20 May 2014 13:36:20 +0100
parents aca6a6604fdc
children f00a2134b1fa
files src/may/stream/format.yeti
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/may/stream/format.yeti	Tue May 20 13:36:02 2014 +0100
+++ b/src/may/stream/format.yeti	Tue May 20 13:36:20 2014 +0100
@@ -29,12 +29,12 @@
     done
    );
 
-decodeFail () = 
-    throw new UnsupportedAudioFileException("Audio format not supported. Supported formats are 8-bit unsigned PCM, 16-bit signed little-endian PCM, or IEEE float");
+decodeFail f is ~AudioFormat -> () = 
+    throw new UnsupportedAudioFileException("Audio format \"\(f#toString())\" not supported. Supported formats are 8-bit unsigned PCM, 16-bit signed little-endian PCM, or IEEE float.");
 
 decode { format is ~AudioFormat } bytes doubles n = 
    (if format#isBigEndian() then
-        decodeFail()
+        decodeFail format;
     else
         enc = format#getEncoding();
         bits = format#getSampleSizeInBits();
@@ -45,7 +45,7 @@
         elif bits == 8 and enc == AudioFormat$Encoding#PCM_UNSIGNED then
             decode8u bytes doubles n;
         else
-            decodeFail();
+            decodeFail format;
         fi
     fi);