Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #504 (assigned enhancement)

Opened 1 year ago

Last modified 5 months ago

create build instruction for TracedExceptions

Reported by: keinfarbton Assigned to: sean (accepted)
Priority: major Milestone: 1.0
Component: Tango Version:
Keywords: triage Cc:

Description

Lessons learned.

After a long time and several tries finally... i found out how make TracedException? work on my machine. Its a pitty, because this is really a great feature. But probably more ppl are not using it simply because they do not know how.

If one tries the example on flectioned readme.html it does not work. It simply prints the message of the exception but without trace.

If one tries to import tango.core.Exception it does not compile. Well and I thought, there is still something wrong with the code, because there is a TracedException? in tango.core.Exception and also in flectioned. How could I know better?

It turns out, that it is only neccessary to include flectioned.d into the rebuild commandline and do nothing about it in the application. Magically it works.

Please make this great feature available for the audience that is as dumb as i am and create a big red pointer to the build instruction that says "yes there is a conflict and this is how it should be, do NOT import flectioned, just put in onto the cmdline".

module te;

import tango.core.Exception; // yes import this one, /NOT/ flectioned.d
import tango.io.Stdout;
class MyException : TracedException{
   this(char[] message){
      super(message);
   }
}

void foo(int i){
   if(i > 0) {
      foo(i - 1);
   } else {
      throw new MyException("message");
   }
}
void main(){
    try{
        foo(2);
    }catch( TracedException e ){
        Stdout.formatln( "trace: {}", e.toUtf8 );
    }
}

build like this

rebuild te.d flectioned.d -g

oh, and simply install it with

dsss net install flectioned

Change History

06/03/07 15:55:13 changed by kris

  • owner changed from kris to sean.
  • version deleted.
  • milestone set to 0.99 RC3.

I agree, though I thought there was an example of how to use it in the distro?

Regardless, this needs a 'tutorial' page of how to set things up. Thanks, Frank. Can you take care of this please, Sean?

(follow-up: ↓ 3 ) 06/03/07 20:47:50 changed by Thomas

I've rewritten parts of the Tango integration.

Since revision 95 cn.kuehne.flectioned.TracedException? derives from tango.core.Exception.TracedException?(the Phobos version still derives from object.Exception) and allows access to the raw trace via TracedException?.trace. For most TracedException? related use cases it should no longer matters if the package is imported or only linked.

(in reply to: ↑ 2 ) 06/04/07 02:41:22 changed by Thomas

The only case where a fully qualified class name is usually required when flectioned is imported is catch:

... } catch (tango.core.Exception.TracedException? e) { ...

07/14/07 17:46:05 changed by sean

  • status changed from new to assigned.
  • milestone changed from 0.99 RC3 to 1.0.

Thanks to Thomas' changes, there isn't much actually required for integration so I'm not considering this one a 0.99 blocker. I'll write something up in the next few days regardless, but am re-targeting to post-0.99 just to have a clean release as far as tickets are concerned.

05/24/08 13:34:22 changed by larsivi

  • keywords set to triage.