digitalmars.D.bugs - [Issue 3129] New: Cannot take advantage of overriding Throwable.toString
- d-bugmail puremagic.com (32/32) Jul 02 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3129
- d-bugmail puremagic.com (11/11) Jul 02 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3129
http://d.puremagic.com/issues/show_bug.cgi?id=3129 Summary: Cannot take advantage of overriding Throwable.toString Product: D Version: 2.030 Platform: x86 URL: http://www.dsource.org/projects/druntime/browser/trunk /src/compiler/dmd/dmain2.d OS/Version: Windows Status: NEW Keywords: patch Severity: normal Priority: P2 Component: druntime AssignedTo: sean invisibleduck.org ReportedBy: maxmo pochta.ru It's a pain when you set Throwable.file, toString function is completely bypassed by catching block in tryExec, so you can't do posponed error message generation. AFAIK, only Error takes advantage of setting file field, so it makes sense to restrict default error output to instances of Error class. No need to worry about losing this functionality since equivalent code is already in Throwable.toString. dmain2.d, line 324 --- - if (e.file) + if (e.file && cast(Error)e) --- Another minor issue is that both Throwable.toString and tryExec iterate through nested exceptions and output trace contexts, so if file field is not set, both of them are executed resulting into duplication of exception info. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 02 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3129 PDT --- Another possible solution is to change line 320 --- - catch (Throwable e) + catch (Error e) --- so that unoverridden Throwable.toString is executed in catch(Object o) block. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 02 2009