What is the API2 replacement for TextInputStream.LastErrorCode

Hello all.
What is the API2 replacement for TextInputStream.LastErrorCode

dim tis as TextInputStream = TextInputStream.Open(m_fOut)

if tis = nil or tis.LastErrorCode <> 0 then <<<=== here…
return “”
end

I do not know for sure but I would guess its Try and Catch ?

That is usually the pattern that replaces LastErrorCode pattern.

1 Like

it is mentioned at notes here
https://documentation.xojo.com/api/files/textinputstream.html#textinputstream

Hello Marcus,

Nothing about LastErrorCode

Thanks anyway!
Tim

read Björn_Eiríksson answer :wink:

It should be

dim tis as TextInputStream 
Try
   tis = TextInputStream.Open(m_fOut)
Catch e as IOException
   return ""
End
2 Likes

To be accurate the the LastErrorCode and also explanation in human readable form will be on the IOException object in Tim’s example above.

1 Like