http://d.puremagic.com/issues/show_bug.cgi?id=10344
--- Comment #19 from Lionello Lunesu <[email protected]> 2013-06-18 02:32:54 PDT --- (In reply to comment #18) > (In reply to comment #17) > > But the question is: what to throw? > > I think throwing an Error would be fine, because the user isn't going to be > catching it anyway. It would be nice to show at least the actual error, based on errno, instead of an hardcoded string. druntime does have the declaration for the C runtime strerror() and .errno so we can do: if (fflush(null) != 0) { auto s = strerror(.errno); throw new Error(s[0..strlen(s)].idup); } resulting in: $ ./hw 1</dev/null object.Error: Bad file descriptor ---------------- 5 hw 0x0000000109e4b765 extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate()) + 45 6 hw 0x0000000109e4b719 _d_run_main + 457 7 hw 0x0000000109e4b548 main + 20 8 libdyld.dylib 0x00007fff8e6107e1 start + 0 9 ??? 0x -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
