www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Bad runtime error message (conversion)

reply Lars Ivar Igesund <larsivar igesund.net> writes:
Upon running a program of mine, it crashes with the (very helpful) message:

"Error: Error: conversion"

Can anybody tell me what kind of statements could cause such an error? A 
line number would have been nice, of course, but I doubt a new version 
incorporating this will turn up today :).

Also, is it possible to have line numbers printed for AVs?

And ArrayBoundsError (Exception...) isn't very exact for the case where 
you try to do
arr[m..n]
when m > n and (0 <= m,n < arr.length).

Lars Ivar Igesund
Jul 23 2004
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Lars Ivar Igesund wrote:

 Upon running a program of mine, it crashes with the (very helpful) message:
 
 "Error: Error: conversion"
 
 Can anybody tell me what kind of statements could cause such an error? A 
 line number would have been nice, of course, but I doubt a new version 
 incorporating this will turn up today :).
Well, found it. I was trying to toInt a zero length string. The error message was somewhat terse, though.
 
 Also, is it possible to have line numbers printed for AVs?
 
 And ArrayBoundsError (Exception...) isn't very exact for the case where 
 you try to do
 arr[m..n]
 when m > n and (0 <= m,n < arr.length).
 
 Lars Ivar Igesund
Jul 23 2004
parent J C Calvarese <jcc7 cox.net> writes:
In article <cdqv2o$1seq$1 digitaldaemon.com>, Lars Ivar Igesund says...
Lars Ivar Igesund wrote:

 Upon running a program of mine, it crashes with the (very helpful) message:
 
 "Error: Error: conversion"
 
 Can anybody tell me what kind of statements could cause such an error? A 
 line number would have been nice, of course, but I doubt a new version 
 incorporating this will turn up today :).
Well, found it. I was trying to toInt a zero length string. The error message was somewhat terse, though.
I agree it can be hard to understand. I haven't run into this particular problem before, but I see how it would be confusing. The error message actually includes the invalid string, but in this case the invalid string is "invisible". Perhaps, we can change line 22 on std\conv.d from to It would help in this case and probably others, too. Here's the code I used to observe the problem: #import std.conv; #void main()
 
 Also, is it possible to have line numbers printed for AVs?
 
 And ArrayBoundsError (Exception...) isn't very exact for the case where 
 you try to do
 arr[m..n]
 when m > n and (0 <= m,n < arr.length).
 
 Lars Ivar Igesund
jcc7
Jul 23 2004