UnDiUdin
UnDiUdin

Reputation: 15374

Reasons why except block in "try..except" is bypassed

I am writing some code against a 3rd party component with no source code. (don't comment on this :) ), something happens when calling a method on that component and even if i put it in a try except block the except block is bypassed.

Am i doing something wrong?

What can be the reason?

begin
  try
    3rdPartyComponentWithNoSourceCode.MethodOne; [A]
    SomeOtherCode;
  except
    HandleException; [A']
  end;
end; [B]

debugging step by step brings me from [A] to [B], without stopping on [A'].

Why?

Upvotes: 1

Views: 250

Answers (2)

NGLN
NGLN

Reputation: 43649

A reason for not reaching HandleException could be that any exception raised within MethodOne might be eaten or handled by MethodOne itself.

But that's propably not the case, because:

something happens

Could you expand on the something?

Upvotes: 0

GolezTrol
GolezTrol

Reputation: 116100

The debugger doesn't jump to exception handlers well when you're stepping through your code. Put a breakpoint on HandleException instead, and it will stop there (if there is an exception in the first place).

Upvotes: 1

Related Questions