www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Error Message useless

reply Tower Ty <tytower hotmail.com.au> writes:
tango.core.Exception.IllegalArgumentException: Argument not valid

This message from the compiler is just bloody useless 
Where do you go in a 200 line program?

All I can see is go to each line that might be a cause and comment it out ,try
to compile it again and if no good do the next one .

Some lines just can't be done anyway .

How hard could it be for you experts to add some detail to the error huh ??
May 09 2008
next sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Tower Ty" <tytower hotmail.com.au> wrote in message 
news:g02qih$16tn$1 digitalmars.com...
 tango.core.Exception.IllegalArgumentException: Argument not valid

 This message from the compiler is just bloody useless
 Where do you go in a 200 line program?

 All I can see is go to each line that might be a cause and comment it out 
 ,try to compile it again and if no good do the next one .

 Some lines just can't be done anyway .

 How hard could it be for you experts to add some detail to the error huh 
 ??
Is this a *compiler* error? Are you *sure*? Do you get the error when you compile the program or when you run it?
May 09 2008
parent reply Tower Ty <towerty msn.com.au> writes:
Jarrett Billingsley Wrote:

 "Tower Ty" <tytower hotmail.com.au> wrote in message 
 news:g02qih$16tn$1 digitalmars.com...
 tango.core.Exception.IllegalArgumentException: Argument not valid

 This message from the compiler is just bloody useless
 Where do you go in a 200 line program?

 All I can see is go to each line that might be a cause and comment it out 
 ,try to compile it again and if no good do the next one .

 Some lines just can't be done anyway .

 How hard could it be for you experts to add some detail to the error huh 
 ??
Is this a *compiler* error? Are you *sure*? Do you get the error when you compile the program or when you run it?
No of course it is a run time error and I'm still looking for it , Jarrett sorry
May 09 2008
next sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Tower Ty" <towerty msn.com.au> wrote in message 
news:g038l7$230k$1 digitalmars.com...
 Jarrett Billingsley Wrote:

 "Tower Ty" <tytower hotmail.com.au> wrote in message
 news:g02qih$16tn$1 digitalmars.com...
 tango.core.Exception.IllegalArgumentException: Argument not valid

 This message from the compiler is just bloody useless
 Where do you go in a 200 line program?

 All I can see is go to each line that might be a cause and comment it 
 out
 ,try to compile it again and if no good do the next one .

 Some lines just can't be done anyway .

 How hard could it be for you experts to add some detail to the error 
 huh
 ??
Is this a *compiler* error? Are you *sure*? Do you get the error when you compile the program or when you run it?
No of course it is a run time error and I'm still looking for it , Jarrett sorry
Yea, that's kind of a problem with getting uncaught exceptions in the abscence of the stack traces that reflection allows. Be glad it's such a small program. What I recommend doing is either step through it in a debugger (if you have one set up), or use debugging output statements. If you're not familiar with the trick of debugging output statements, it's like this: Start with main() and sprinkle normal output statements through it. For instance, if your main() is like this: void main() { someFunc(); if(something) doSomething(); anotherFunc(); yetAnotherFunc(); } Then do this: void main() { Stdout("1").newline; someFunc(); Stdout("2").newline; if(something) { Stdout("3").newline; doSomething(); Stdout("4").newline; } Stdout("5").newline; anotherFunc(); Stdout("6").newline; yetAnotherFunc(); Stdout("7").newline; } Obviously, copy/paste helps there ;) Run that and you'll get something like: 1 2 5 tango.core.Exception.IllegalArgumentException: Argument not valid In this case, we know the if() ended up false and "doSomething()" was skipped, and we also know the exception was thrown somewhere in "anotherFunc()". So rip those "Stdout's" out of there, and do the same thing in "anotherFunc()". Keep drilling down like that until you find the problem. I do that all the time in my own code (because so far I've been too lazy to actually get a debugger set up with D :) ).
May 09 2008
next sibling parent Ty Tower <towerty msn.com.au> writes:
Nick Sabalausky Wrote:

 "Tower Ty" <towerty msn.com.au> wrote in message 
 news:g038l7$230k$1 digitalmars.com...
 Jarrett Billingsley Wrote:

 "Tower Ty" <tytower hotmail.com.au> wrote in message
 news:g02qih$16tn$1 digitalmars.com...
 tango.core.Exception.IllegalArgumentException: Argument not valid

 This message from the compiler is just bloody useless
 Where do you go in a 200 line program?

 All I can see is go to each line that might be a cause and comment it 
 out
 ,try to compile it again and if no good do the next one .

 Some lines just can't be done anyway .

 How hard could it be for you experts to add some detail to the error 
 huh
 ??
Is this a *compiler* error? Are you *sure*? Do you get the error when you compile the program or when you run it?
No of course it is a run time error and I'm still looking for it , Jarrett sorry
Yea, that's kind of a problem with getting uncaught exceptions in the abscence of the stack traces that reflection allows. Be glad it's such a small program. What I recommend doing is either step through it in a debugger (if you have one set up), or use debugging output statements. If you're not familiar with the trick of debugging output statements, it's like this: Start with main() and sprinkle normal output statements through it. For instance, if your main() is like this: void main() { someFunc(); if(something) doSomething(); anotherFunc(); yetAnotherFunc(); } Then do this: void main() { Stdout("1").newline; someFunc(); Stdout("2").newline; if(something) { Stdout("3").newline; doSomething(); Stdout("4").newline; } Stdout("5").newline; anotherFunc(); Stdout("6").newline; yetAnotherFunc(); Stdout("7").newline; } Obviously, copy/paste helps there ;) Run that and you'll get something like: 1 2 5 tango.core.Exception.IllegalArgumentException: Argument not valid In this case, we know the if() ended up false and "doSomething()" was skipped, and we also know the exception was thrown somewhere in "anotherFunc()". So rip those "Stdout's" out of there, and do the same thing in "anotherFunc()". Keep drilling down like that until you find the problem. I do that all the time in my own code (because so far I've been too lazy to actually get a debugger set up with D :) ).
Thanks
May 10 2008
prev sibling next sibling parent reply Mike <vertex gmx.at> writes:
On Sat, 10 May 2008 08:12:25 +0200, Nick Sabalausky <a a.a> wrote:

 Then do this:

 void main()
 {
 Stdout("1").newline;
    someFunc();
 Stdout("2").newline;
    if(something)
    {
 Stdout("3").newline;
        doSomething();
 Stdout("4").newline;
    }
 Stdout("5").newline;
    anotherFunc();
 Stdout("6").newline;
    yetAnotherFunc();
 Stdout("7").newline;
 }
Oh ... how many time have I wished there was an IDE command to do that :) I do this all the time and I've always wondered if other people do that too ... I call it "laying traps" and I found usually it's best to first put not too many Stdouts in there, e.g. one every 4-5 statements if you're not really sure where the error happens. Then you can go in and put some "3a" "3b" and so on to find the exact statement that causes the problem. That's, btw, a good reason to put single-line-if/elses into {}s instead of writing them on the same line. Easier to put Stdouts in if you need them. -Mike -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
May 10 2008
parent reply "Nick Sabalausky" <a a.a> writes:
"Mike" <vertex gmx.at> wrote in message news:op.uaxjm1sjkgfkbn lucia...
 On Sat, 10 May 2008 08:12:25 +0200, Nick Sabalausky <a a.a> wrote:

 Then do this:

 void main()
 {
 Stdout("1").newline;
    someFunc();
 Stdout("2").newline;
    if(something)
    {
 Stdout("3").newline;
        doSomething();
 Stdout("4").newline;
    }
 Stdout("5").newline;
    anotherFunc();
 Stdout("6").newline;
    yetAnotherFunc();
 Stdout("7").newline;
 }
Oh ... how many time have I wished there was an IDE command to do that :)
You've just made me feel incredibly stupid. That particular "Why in the world did that never occur to me?" kind of stupid. My forehead still hurts from the smack. ;) I'll have to attempt that next time I use an IDE that has programmable macros (Visual Studio). Hmm, I wonder if C::B has macros...
 I do this all the time and I've always wondered if other people do that 
 too ... I call it "laying traps" and I found usually it's best to first 
 put not too many Stdouts in there, e.g. one every 4-5 statements if you're 
 not really sure where the error happens. Then you can go in and put some 
 "3a" "3b" and so on to find the exact statement that causes the problem.
Heh, yup. Same thing here. I always think of it like playing that old "HiLo" number-guessing game that used to be a staple of learning a new language.
 That's, btw, a good reason to put single-line-if/elses into {}s instead of 
 writing them on the same line. Easier to put Stdouts in if you need them.
I find that turning a single-statement if into a {} block when needed is trivial enough of a change (almost second-nature) to justify keeping single-statement if's in a nice compact {}-less form (unless the clause or single-statement is long enough to be broken into multiple lines for readability). But I'm really compulsive when it comes to code formatting anyway (everything's gotta be "just so" or I can't focus, kinda like that TV detective Monk, albiet far less severe ;) ).
May 10 2008
parent reply Mike <vertex gmx.at> writes:
On Sat, 10 May 2008 11:03:38 +0200, Nick Sabalausky <a a.a> wrote:

 You've just made me feel incredibly stupid. That particular "Why in the
 world did that never occur to me?" kind of stupid. My forehead still  
 hurts
 from the smack. ;)
:)
 I find that turning a single-statement if into a {} block when needed is
 trivial enough of a change (almost second-nature) to justify keeping
 single-statement if's in a nice compact {}-less form (unless the clause  
 or
 single-statement is long enough to be broken into multiple lines for
 readability). But I'm really compulsive when it comes to code formatting
 anyway (everything's gotta be "just so" or I can't focus, kinda like  
 that TV
 detective Monk, albiet far less severe ;) ).
Yeah, I hate it when Eclipse starts to put my case statements on the wrong indentation level. That supports the theory that programmers often tend to have a little trace of authism in their personality. Sometimes small details can drive me mad and I spend lots of time formatting console output so that it lines up neatly or stuff like that. Another thing about Stdout debugging: it's nice to define an alias for Stdout in a debug { } block and use that alias for debug messages, preferably in a module that's used everywhere in a project. I do that since once, back in my C++ days, one of my "in here" couts went into production - the alias prevents that. -Mike -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
May 11 2008
next sibling parent reply Tower Ty <tytower hotmail.com> writes:
Mike Wrote:

 On Sat, 10 May 2008 11:03:38 +0200, Nick Sabalausky <a a.a> wrote:
 
 You've just made me feel incredibly stupid. That particular "Why in the
 world did that never occur to me?" kind of stupid. My forehead still  
 hurts
 from the smack. ;)
:)
 I find that turning a single-statement if into a {} block when needed is
 trivial enough of a change (almost second-nature) to justify keeping
 single-statement if's in a nice compact {}-less form (unless the clause  
 or
 single-statement is long enough to be broken into multiple lines for
 readability). But I'm really compulsive when it comes to code formatting
 anyway (everything's gotta be "just so" or I can't focus, kinda like  
 that TV
 detective Monk, albiet far less severe ;) ).
Yeah, I hate it when Eclipse starts to put my case statements on the wrong indentation level. That supports the theory that programmers often tend to have a little trace of authism in their personality. Sometimes small details can drive me mad and I spend lots of time formatting console output so that it lines up neatly or stuff like that. Another thing about Stdout debugging: it's nice to define an alias for Stdout in a debug { } block and use that alias for debug messages, preferably in a module that's used everywhere in a project. I do that since once, back in my C++ days, one of my "in here" couts went into production - the alias prevents that. -Mike -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
If you are proud of your work its job satisfaction to clean it up and pretty up the output. Can you explain the debug{} a bit more please Mike . What does that look like and how is it used?
May 11 2008
parent reply Mike <vertex gmx.at> writes:
On Mon, 12 May 2008 00:22:39 +0200, Tower Ty <tytower hotmail.com> wrote=
:

 Can you explain the debug{} a bit more please  Mike . What does that  =
 look like and how is it used?
It's code that only gets compiled in a debug build. Here's roughly what I do: debug { alias Stdout dbg; } Later on I use Stdout for every normal output, but dbg for temporary deb= ug = messages: <example> Stdout("Initializing warp drive ...").newline; // this should be in the = = console in debug and release mode WarpEngine.prepareUnipolarMatrixPhalanxThingie(unipolar); dbg("first call ok, foo =3D ")(WarpEngine.foo).newline; // this should b= e = removed before release WarpEngine.resetWarpParameterFieldConstants(1, 2, 1701); dbg("second call ok, bar =3D ")(WarpEngine.bar).newline; WarpEngine.initializeWarpNacelles(BOTH); dbg("third call ok, baz =3D ")(WarpEngine.baz).newline; WarpEngine.removeTribbles(all); dbg("fourth call ok, now engaging").newline; WarpEngine.engage(); Stdout("Warp drive ready.").newline; </example> Those dbg Stdouts should be removed in a release build. But every now an= d = then you forget to remove one and it ends up in production. So if you no= w = compile this with the -release flag, the alias never gets defined and = every dbg call still in there yields a syntax error. -Mike PS: I'm NOT a Star Trek fan :) -- = Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
May 12 2008
parent Ty Tower <tytower hotmail.com> writes:
Mike Wrote:

 On Mon, 12 May 2008 00:22:39 +0200, Tower Ty <tytower hotmail.com> wrote:
 
 Can you explain the debug{} a bit more please  Mike . What does that  
 look like and how is it used?
It's code that only gets compiled in a debug build. Here's roughly what I do:
 
 debug
 {
      alias Stdout dbg;
 }
 Compile with -debug switch on!
 Later on I use Stdout for every normal output, but dbg for temporary debug  
 messages:
 
 <example>
 
 Stdout("Initializing warp drive ...").newline; // this should be in the  
 console in debug and release mode
 
 WarpEngine.prepareUnipolarMatrixPhalanxThingie(unipolar);
 dbg("first call ok, foo = ")(WarpEngine.foo).newline; // this should be  
 removed before release
 
 WarpEngine.resetWarpParameterFieldConstants(1, 2, 1701);
 dbg("second call ok, bar = ")(WarpEngine.bar).newline;
 
 WarpEngine.initializeWarpNacelles(BOTH);
 dbg("third call ok, baz = ")(WarpEngine.baz).newline;
 
 WarpEngine.removeTribbles(all);
 dbg("fourth call ok, now engaging").newline;
 
 WarpEngine.engage();
 
 Stdout("Warp drive ready.").newline;
 
 </example>
 
 Those dbg Stdouts should be removed in a release build. But every now and  
 then you forget to remove one and it ends up in production. So if you now  
 compile this with the -release flag, the alias never gets defined and  
 every dbg call still in there yields a syntax error.
 
 -Mike
 
 PS: I'm NOT a Star Trek fan :)
 
 -- 
 Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Thanks Mike - Missed it on the first pass but Note for Learners like me Compile with -debug switch on!
May 12 2008
prev sibling parent reply Robert Fraser <fraserofthenight gmail.com> writes:
Mike wrote:
 Yeah, I hate it when Eclipse starts to put my case statements on the 
 wrong indentation level.
Both JDT and Descent let you choose. Window > Preferences > Java/D > Code Style > Formatter > Edit... > Indentation
May 11 2008
parent reply Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
Robert Fraser wrote:
 Mike wrote:
 Yeah, I hate it when Eclipse starts to put my case statements on the 
 wrong indentation level.
Both JDT and Descent let you choose. Window > Preferences > Java/D > Code Style > Formatter > Edit... > Indentation
I think I know what he means: unfortunately, Descent doesn't seem to pay attention to that setting when you're just typing code. If I try to type --- void foo(int bar) { switch (bar) { case 1: } } --- I instead get: --- void foo(int bar) { switch (bar) { case 1: } } --- Note the indenting of 'case'. This is with the checkbox for [Indent] "'case'/'default' statements within 'switch'" turned on. And it happens whether or not I press 'tab' before typing 'case'. (If I use tab to manually indent the 'case', it *unindents* the moment I hit 'e'!) Pressing Ctrl-Shift-F fixes the indentation; this seems to be an auto-indenting issue, not a formatter issue. (Descent 0.5.2.20080501, Eclipse 3.2.2 / M20070212-1330 (Ubuntu version: 3.2.2-5ubuntu2))
May 12 2008
next sibling parent Mike <vertex gmx.at> writes:
On Mon, 12 May 2008 13:06:45 +0200, Frits van Bommel  
<fvbommel REMwOVExCAPSs.nl> wrote:

 Robert Fraser wrote:
 I think I know what he means: unfortunately, Descent doesn't seem to pay  
 attention to that setting when you're just typing code. If I try to type
 ---
 void foo(int bar) {
      switch (bar) {
          case 1:
      }
 }
 ---
 I instead get:
 ---
 void foo(int bar) {
      switch (bar) {
      case 1:
      }
 }
 ---
 Note the indenting of 'case'. This is with the checkbox for [Indent]  
 "'case'/'default' statements within 'switch'" turned on. And it happens  
 whether or not I press 'tab' before typing 'case'. (If I use tab to  
 manually indent the 'case', it *unindents* the moment I hit 'e'!)

 Pressing Ctrl-Shift-F fixes the indentation; this seems to be an  
 auto-indenting issue, not a formatter issue.

 (Descent 0.5.2.20080501, Eclipse 3.2.2 / M20070212-1330 (Ubuntu version:  
 3.2.2-5ubuntu2))
Exactly. It seems to do it only with the first case, however. -Mike -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
May 12 2008
prev sibling parent reply Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
Frits van Bommel wrote:
[description of switch/case indent bug]

I figured since I took the time to type that up I might as well 
officially report it in trac: 
<http://dsource.org/projects/descent/ticket/82>
May 12 2008
parent reply Mike <vertex gmx.at> writes:
On Mon, 12 May 2008 22:41:32 +0200, Frits van Bommel  
<fvbommel REMwOVExCAPSs.nl> wrote:

 Frits van Bommel wrote:
 [description of switch/case indent bug]

 I figured since I took the time to type that up I might as well  
 officially report it in trac:  
 <http://dsource.org/projects/descent/ticket/82>
Thanks! I didn't know it was a Descent bug (would have reported that long ago), just assumed that I didn't find the correct setting :) -Mike -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
May 12 2008
parent reply Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
Mike wrote:
 On Mon, 12 May 2008 22:41:32 +0200, Frits van Bommel 
 <fvbommel REMwOVExCAPSs.nl> wrote:
 
 Frits van Bommel wrote:
 [description of switch/case indent bug]

 I figured since I took the time to type that up I might as well 
 officially report it in trac: 
 <http://dsource.org/projects/descent/ticket/82>
Thanks! I didn't know it was a Descent bug (would have reported that long ago), just assumed that I didn't find the correct setting :)
Well if it isn't a bug one of the devs will hopefully mark it invalid and tell us how to configure it to do what we want :).
May 12 2008
parent Robert Fraser <fraserofthenight gmail.com> writes:
Frits van Bommel wrote:
 Mike wrote:
 On Mon, 12 May 2008 22:41:32 +0200, Frits van Bommel 
 <fvbommel REMwOVExCAPSs.nl> wrote:

 Frits van Bommel wrote:
 [description of switch/case indent bug]

 I figured since I took the time to type that up I might as well 
 officially report it in trac: 
 <http://dsource.org/projects/descent/ticket/82>
Thanks! I didn't know it was a Descent bug (would have reported that long ago), just assumed that I didn't find the correct setting :)
Well if it isn't a bug one of the devs will hopefully mark it invalid and tell us how to configure it to do what we want :).
Nope; it's a bug; thanks for reporting it.
May 12 2008
prev sibling next sibling parent Ary Borenszweig <ary esperanto.org.ar> writes:
Nick Sabalausky escribió:
 "Tower Ty" <towerty msn.com.au> wrote in message 
 news:g038l7$230k$1 digitalmars.com...
 Jarrett Billingsley Wrote:

 "Tower Ty" <tytower hotmail.com.au> wrote in message
 news:g02qih$16tn$1 digitalmars.com...
 tango.core.Exception.IllegalArgumentException: Argument not valid

 This message from the compiler is just bloody useless
 Where do you go in a 200 line program?

 All I can see is go to each line that might be a cause and comment it 
 out
 ,try to compile it again and if no good do the next one .

 Some lines just can't be done anyway .

 How hard could it be for you experts to add some detail to the error 
 huh
 ??
Is this a *compiler* error? Are you *sure*? Do you get the error when you compile the program or when you run it?
No of course it is a run time error and I'm still looking for it , Jarrett sorry
Yea, that's kind of a problem with getting uncaught exceptions in the abscence of the stack traces that reflection allows. Be glad it's such a small program. What I recommend doing is either step through it in a debugger
I forgot to tell in the release, but Descent now stops execution at the point where an uncaught exception is thrown when debugging with ddbg.
May 10 2008
prev sibling parent reply janderson <askme me.com> writes:
Nick Sabalausky wrote:
<snip>
 If you're not familiar with the trick of debugging output statements, it's 
 like this: Start with main() and sprinkle normal output statements through 
 it. For instance, if your main() is like this:
 
 void main()
 {
    someFunc();
    if(something)
        doSomething();
    anotherFunc();
    yetAnotherFunc();
 }
 
 Then do this:
 
 void main()
 {
 Stdout("1").newline;
    someFunc();
 Stdout("2").newline;
    if(something)
    {
 Stdout("3").newline;
        doSomething();
 Stdout("4").newline;
    }
 Stdout("5").newline;
    anotherFunc();
 Stdout("6").newline;
    yetAnotherFunc();
 Stdout("7").newline;
 }
 
 Obviously, copy/paste helps there ;) Run that and you'll get something like:
 
 1
 2
 5
 tango.core.Exception.IllegalArgumentException: Argument not valid
 
 In this case, we know the if() ended up false and "doSomething()" was 
 skipped, and we also know the exception was thrown somewhere in 
 "anotherFunc()". So rip those "Stdout's" out of there, and do the same thing 
 in "anotherFunc()". Keep drilling down like that until you find the problem.
 
 I do that all the time in my own code (because so far I've been too lazy to 
 actually get a debugger set up with D :) ).
 
 
Here's a tip: Use: __FILE__, __LINE__ in your arguments. That way you don't need to keep changing the value. I bet one could write a mixin that would do this automatically and you'd simply wrap each function in that mixin. -Joel
May 10 2008
parent reply janderson <askme me.com> writes:
janderson wrote:
 Nick Sabalausky wrote:
 <snip>
 If you're not familiar with the trick of debugging output statements, 
 it's like this: Start with main() and sprinkle normal output 
 statements through it. For instance, if your main() is like this:

 void main()
 {
    someFunc();
    if(something)
        doSomething();
    anotherFunc();
    yetAnotherFunc();
 }

 Then do this:

 void main()
 {
 Stdout("1").newline;
    someFunc();
 Stdout("2").newline;
    if(something)
    {
 Stdout("3").newline;
        doSomething();
 Stdout("4").newline;
    }
 Stdout("5").newline;
    anotherFunc();
 Stdout("6").newline;
    yetAnotherFunc();
 Stdout("7").newline;
 }

 Obviously, copy/paste helps there ;) Run that and you'll get something 
 like:

 1
 2
 5
 tango.core.Exception.IllegalArgumentException: Argument not valid

 In this case, we know the if() ended up false and "doSomething()" was 
 skipped, and we also know the exception was thrown somewhere in 
 "anotherFunc()". So rip those "Stdout's" out of there, and do the same 
 thing in "anotherFunc()". Keep drilling down like that until you find 
 the problem.

 I do that all the time in my own code (because so far I've been too 
 lazy to actually get a debugger set up with D :) ).
Here's a tip: Use: __FILE__, __LINE__ in your arguments. That way you don't need to keep changing the value. I bet one could write a mixin that would do this automatically and you'd simply wrap each function in that mixin. -Joel
On further thought that might not work. I'm not sure what would be in __FILE__ and __LINE__. However the mixin could still print out the actual code that was just before the ";". -Joel
May 10 2008
parent "Simen Kjaeraas" <simen.kjaras gmail.com> writes:
On Sun, 11 May 2008 02:04:00 +0200, janderson <askme me.com> wrote:

 janderson wrote:
  Here's a tip:
  Use: __FILE__, __LINE__ in your arguments.  That way you don't need =
to =
 keep changing the value.
  I bet one could write a mixin that would do this automatically and  =
 you'd simply wrap each function in that mixin.
  -Joel
On further thought that might not work. I'm not sure what would be in=
=
 __FILE__ and __LINE__.  However the mixin could still print out the  =
 actual code that was just before the ";".

 -Joel
import std.stdio; import std.traits; template _debug(alias f, int line =3D __LINE__, string file =3D __FILE__= ) { ReturnType!(f) _debug(ParameterTypeTuple!(f) u) { writefln("%s(%d) executed.", file, line); return f(u); } } Usage: _debug(function)(parameters); There might be a simpler, more prettiful way to find the return type and= = parameters, but this works. -- Simen
May 11 2008
prev sibling parent Fawzi Mohamed <fmohamed mac.com> writes:
On 2008-05-10 06:34:47 +0200, Tower  Ty <towerty msn.com.au> said:

 Jarrett Billingsley Wrote:
 
 "Tower Ty" <tytower hotmail.com.au> wrote in message
 news:g02qih$16tn$1 digitalmars.com...
 tango.core.Exception.IllegalArgumentException: Argument not valid
 
 This message from the compiler is just bloody useless
 Where do you go in a 200 line program?
 
 All I can see is go to each line that might be a cause and comment it out
 ,try to compile it again and if no good do the next one .
 
 Some lines just can't be done anyway .
 
 How hard could it be for you experts to add some detail to the error huh
 ??
Is this a *compiler* error? Are you *sure*? Do you get the error when you compile the program or when you run it?
No of course it is a run time error and I'm still looking for it , Jarrett sorry
I recently had to look for a similar error. I think the easiest thing is to compile everything with -g and use a debugger. Then put a breackpoint when the exception is created (or in the handler to create the stack trace: traceContext in tango): genobj.d:916 (gdc) genobj.d:910 (dmd) please not that there is an open bug wrt. this with out of bounds exceptions on macintosh and Linux with gdc the stack can get garbled http://www.dsource.org/projects/tango/ticket/1094 Fawzi
May 10 2008
prev sibling next sibling parent reply Jason House <jason.james.house gmail.com> writes:
Tower  Ty wrote:

 tango.core.Exception.IllegalArgumentException: Argument not valid
 
 This message from the compiler is just bloody useless
 Where do you go in a 200 line program?
 
 All I can see is go to each line that might be a cause and comment it out
 ,try to compile it again and if no good do the next one .
 
 Some lines just can't be done anyway .
 
 How hard could it be for you experts to add some detail to the error huh
 ??
Do a try catch at global scope and use the member variables of the exception to print out extra detail. Tango exceptions include file and line number as member data. Maybe someone should submit a ticket for them to add that info to the default toString method.
May 10 2008
parent Ty Tower <tytower hotmail.com> writes:
Jason House Wrote:
Do a try catch at global scope and use the member variables of the exception
to print out extra detail. Tango exceptions include file and line number as member data. Maybe someone should submit a ticket for them to add that info to the default toString method.<< Now thats the stuff . Its just a matter of simplifying it for learners . If it doesn't give a line ,or statement ,or argument, you end up like a stunned mullet for a while. Thanks for responses
May 10 2008
prev sibling parent Jussi Jumppanen <jussij zeusedit.com> writes:
Nick Sabalausky Wrote:

 I'll have to attempt that next time I use an IDE 
 that has programmable macros (Visual Studio). Hmm, 
 I wonder if C::B has macros...
FWIW the Zeus IDE is fully scriptable and also has support for the D programming language (ie code folding, syntax highlighting etc). With a bit of tweaking Zeus can even be configure to let you script using DMDScript: http://www.zeusedit.com/forum/viewtopic.php?t=225 Jussi Jumppanen Author: Zeus for Windows IDE
May 12 2008