exceptions
This is an old revision of the document!
Exceptions
As already described in the topic Try - Catch the .NET Framework uses exceptions to notify about an error condition.
Take as sample the String:SubString()
method:
local cString as string local cResult as string cString := "Hello world" cResult := cString:Substring( 5, 30 )
Since the string is less than 35 characters long, this code produces an OutOfRangeException.
So, when using this method on strings, you have a few possibilities:
- use this method only enclosed in a
try-catch
block - check the string length and adjust the parameters accordingly
- or use an own method (for example a static method or an Attached method of the System.String class
exceptions.1517160277.txt.gz · Last modified: 2018/01/28 17:24 by wolfgangriedmann