重新抛出异常

异常处理

uses System.SysUtils;

procedure MethodWithException;
begin
  try
    raise Exception.Create('test exception');
  except
    //部分处理后,再把异常继续传递:
    //单独的 raise 会重新抛出当前异常
    on E: Exception do
    begin
      WriteLn('partial processing');
      raise;
    end;
  end;
end;

begin
  try
    MethodWithException;
  except
    on E: Exception do
      WriteLn(E.Message);
  end;
end.