[macruby-changes] [1621] MacRuby/branches/experimental/io.c

source_changes at macosforge.org source_changes at macosforge.org
Wed May 27 19:00:53 PDT 2009


Revision: 1621
          http://trac.macosforge.org/projects/ruby/changeset/1621
Author:   lsansonetti at apple.com
Date:     2009-05-27 19:00:53 -0700 (Wed, 27 May 2009)
Log Message:
-----------
better error reporting upon read failure

Modified Paths:
--------------
    MacRuby/branches/experimental/io.c

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-05-28 01:53:15 UTC (rev 1620)
+++ MacRuby/branches/experimental/io.c	2009-05-28 02:00:53 UTC (rev 1621)
@@ -831,20 +831,12 @@
 	}
 	else if (code == -1) {
 	    CFErrorRef er = CFReadStreamCopyError(readStream);
-	    CFStringRef failure_reason = CFErrorCopyFailureReason(er);
+	    CFStringRef desc = CFErrorCopyDescription(er);
 	    CFRelease(er);
-	    if (failure_reason != NULL) {
-		CFShow(failure_reason);
-		CFStringRef pretty = CFStringCreateWithFormat(NULL, NULL,
-			CFSTR("Internal error while reading stream: %@"),
-			failure_reason);
-		CFRelease(failure_reason);
-		if (pretty != NULL) {
-		    rb_raise(rb_eRuntimeError, "%s",
-			    (char*)CFStringGetCharactersPtr(pretty));
-		}
-	    }
-	    rb_raise(rb_eRuntimeError, "internal error while reading stream:");
+	    CFMakeCollectable(desc);
+	    rb_raise(rb_eRuntimeError,
+		    "internal error while reading stream: %s",
+		    RSTRING_PTR(desc));
 	}
 
 	data_read += code;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090527/b8796e47/attachment-0001.html>


More information about the macruby-changes mailing list