Exception Handling

BlitzMax Forums/BlitzMax Programming/Exception Handling

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Yes readstring does not have a throw in it, but readbytes which is called from readstring does have a throw.


from stream.bmx (module BRL.Stream)
Method ReadBytes( buf:Byte Ptr,count )
	Local n=count
	While count>0 And Not Eof()
		Local n=Read( buf,count )
	        If Not n Throw New TStreamReadException
		count:-n
		buf:+n
	Wend
	Return n
End Method


so your change should not be required as ReadBytes is called from readstring. Plus the documentation also states

Function ReadString$( stream:TStream,length ) 
Returns A String of length length  
Description Read a String from a stream 
Information A TStreamReadException is thrown if not all bytes could be read.  


Stepping through the code it seems like it ignores the asserts when the end of file occurs mid string an just keeps reading.

Is this a bug or something that could be addressed for the next release?

Cheers.