This is just the debugger. It's probably just getting an expected error (one handled by a try..except
in the FR code) and properly dealing with it, but the debugger has no way of knowing that and tells you the exception happened. (It's a common issue when working with Indy, which raises exceptions as part of normal program flow.)
There are three ways to deal with this situation when debugging:
Just hit
Continue
on the exception dialog when it appears. (You can tell it's a debugger exception because you get theBreak
orContinue
option, and because it only happens when debugging.)You can disable a specific exception class (or all exceptions) when debugging, using the
Tools->Options->Debugger Options
. In this case, you can addEVariantTypeCastError
to the list of exceptions to ignore.(My preferred method) Use the
Advanced Breakpoint Properties
dialog to skip the debugger's exception handling around the specific line of code you know will raise the exception you want to ignore.- Set a breakpoint on the line immediately before the problem code line.
- Right-click the breakpoint on the line before, and choose
Breakpoint Properties
from the context menu. - Click the
Advanced
button on theBreakpoint Properties
dialog, and in theActions
groupbox, uncheckBreak
and checkIgnore subsequent exceptions
. - Repeat the previous steps on the line after the problem code, except check
Break
and uncheckIgnore subsequent exceptions
on this second breakpoint. - Run your code as usual. The debugger will skip it's exception handling on the code between the two breakpoints.
The advantage of option #3 is that it ignores all exception handling, but only on the code block between the two breakpoints, so you still get exceptions in all other areas of your code that may be valid exceptions in the debugger.