digitalmars.D.bugs - [Issue 10989] New: [CTFE] Uncaught exception messages are not pretty printed if message wasn't literal
- d-bugmail puremagic.com (40/40) Sep 07 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10989
- d-bugmail puremagic.com (18/18) Sep 10 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10989
- d-bugmail puremagic.com (6/6) Sep 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10989
- d-bugmail puremagic.com (9/9) Sep 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10989
- d-bugmail puremagic.com (10/10) Sep 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10989
http://d.puremagic.com/issues/show_bug.cgi?id=10989 Summary: [CTFE] Uncaught exception messages are not pretty printed if message wasn't literal Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: dmitry.olsh gmail.com 15:40:59 PDT --- import std.string; enum foo = (){ throw new Exception(format("Something %d wicked happened!", 42)); return 0; }(); On a recent DMD from git master: D:\D\ctfe_ex.d(4): Error: Uncaught CTFE exception object.Exception(['S', 'o', 'm', 'e', 't', 'h', 'i', 'n', 'g', ' ', '4', '2', ' ', 'w', 'i', 'c', 'k', 'e', 'd', ' ', 'h', 'a', 'p', 'p', 'e', 'n', 'e', 'd', '!'][0u..29u]) D:\D\ctfe_ex.d(6): called from here: (*int() { throw new Exception(format("Something %d wicked happened!", 42), "D:\\D\\ctfe_ex.d", 4u, null); return 0; } Note that the following using plain literal neatly formats the string: enum foo = (){ throw new Exception("Something wicked happened!"); return 0; }(); D:\D\ctfe_ex.d(2): Error: Uncaught CTFE exception object.Exception("Something wicked happened!") The point is it should always pretty print it unless it contains bad UTF-8. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 07 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10989 Patch: --- a/src/ctfeexpr.c +++ b/src/ctfeexpr.c -157,7 +157,7 char *ThrownExceptionExp::toChars() void ThrownExceptionExp::generateUncaughtError() { thrown->error("Uncaught CTFE exception %s(%s)", thrown->type->toChars(), - (*thrown->value->elements)[0]->toChars()); + (*thrown->value->elements)[0]->toString()->toChars()); /* Also give the line where the throw statement was. We won't have it * in the case where the ThrowStatement is generated inter Reduced test case: enum foo = () { throw new Exception(['a', 'b', 'c']); return 0; }(); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 10 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10989 https://github.com/D-Programming-Language/dmd/pull/2563 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10989 Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8779d47334e6b1f7cfab13a8955cdceb733d403a Fix bug 10989 [CTFE] Uncaught exception messages are not pretty printed Convert it to a StringExp before printing. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10989 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 16 2013