Last update March 25, 2011

Error Messages /
Runtime Errors



Difference (last change) (no other diffs, normal page display)

Added: 76a77,79
==An exception was thrown while finalizing an instance of class

An exception is being thrown from the destructor of the class.

Table of contents of this page
Access Violation   
Format String Mismatch with Arguments for printf   
Uninitialized Object   
Error: Array Bounds Error   
Error: not enough data in stream   
Case Study   
Error: conversion   
An exception was thrown while finalizing an instance of class   

Access Violation    

See also NG:D/26297.

Format String Mismatch with Arguments for printf    

Problem code, from ( NG:D/26447):

import std.compiler;
int main()
{
   // this gets an Access Violation
   printf("%s\n", std.compiler.name);

   return 0;
}

Change

printf("%s", s);
to
printf("%.*s", s);

See also HowTo/printf, FaqRoadmap#ErrorMessages, NG:D/26472.

Uninitialized Object    

Problem code:

void main()
{  
   Object o;
   printf("%.*s", o.toString);
}

Change

Object o;
to
Object o = new Object();

See also NG:D/26317.

Error: Array Bounds Error    

Problem code:

void main()
{  
   int[] a;
   a[0] = 0;		
}

If it's compiled in release (dmd arrays.d -release), it the error is expressed as "Error: Access Violation".

Add this line

a.length = 1;
before
a[0] = 0;

void main()
{  
   int[] a;
   a.length = 1;
   a[0] = 0;		
}

Error: not enough data in stream    

Case Study    

The problem was caused by the server's software where I was getting the data from, which, by the way, is written in Java. I was trying to acquire data from that server using D. D acted accordingly, so the problem was java memory cap setting. The cap was set for 128MB of memory. The amount of XML that I was downloading exceeded that amount and I kept getting that "Error: not enough data in stream." After raising the memory cap to 1024MB, the problem went away.

Apparently, d was reading socket.datastream from the server ok, but when the amount of data from the server exceeded 128MB, the server stopped sending data and D aborted with "Error: not enough data in stream." This confused me a bit and I thought that it was something on my side. (Perhaps we should change that error.) But, this only meant that no data at all and the server closed the socket connection. It didn't even send any http headers or anything. Weird. It just returned a null string.

Adapted from NG:digitalmars.D/18731

Error: conversion    

An exception was thrown while finalizing an instance of class    

An exception is being thrown from the destructor of the class.

FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: March 25, 2011 20:10 (diff))