Re: Try..Except: How?
- From: Rob Kennedy <me3@xxxxxxxxxxx>
- Date: Sat, 27 May 2006 12:22:18 -0500
JamesR wrote:
Well, perhaps crash was the wrong work.. I mean, it causes an error and
stops execution when run under the debugger.. but surely it should
execute the 'except' block?
Yes. And it will, if you tell the debugger to allow your program to continue running. So far, it's just paused at the point of the exception to let you, the developer, inspect the state of your program and determine the error that caused the exception to be raised in the first place.
"But why doesn't the debugger see that I have an 'except' block already and just skip to there?" That's your next question, right?
If the debugger did that, then it would *never* stop on exceptions. *All* code in your program is wrapped in at least one exception handler, often more. When an exception occurs and your program displays a message box with the exception's message, that's a result of TApplication's default exception handler. When a program crashes and the OS displays the "send feedback" dialog, that's as part of the exception handler that gets installed at the base of every program when it starts running.
In this particular case, you can use the TryStrToInt function to avoid the exception altogether.
--
Rob
.
- References:
- Try..Except: How?
- From: JamesR
- Re: Try..Except: How?
- From: Terry Russell
- Re: Try..Except: How?
- From: JamesR
- Try..Except: How?
- Prev by Date: Re: Try..Except: How?
- Next by Date: Re: Try..Except: How?
- Previous by thread: Re: Try..Except: How?
- Next by thread: Re: Try..Except: How?
- Index(es):
Relevant Pages
|
Loading