try.except怎么抛出错误

try...except如何抛出异常Delphi(Pascal) codefor i : 1 to query1.FieldCount dotryAColumn : PBP_Grid

try...except如何抛出异常

Delphi(Pascal) code
    for i := 1 to query1.FieldCount do    try      AColumn := PBP_Grid_ColumnByField(dxGridMain, 'f'+inttostr(i));      if AColumn.Visible then        sqlstr := sqlstr + query1.FieldByName(AColumn.caption).AsString + ','      else        sqlstr := sqlstr + 'NULL,';    except      begin        showmessage('Excel文件有误,导入失败。');        exit;      end;    end;

初学者,求各位大神解决一下,如何抛出异常?

[解决办法]
Delphi(Pascal) code
for i := 1 to query1.FieldCount dobegin    try      AColumn := PBP_Grid_ColumnByField(dxGridMain, 'f'+inttostr(i));      if AColumn.Visible then        sqlstr := sqlstr + query1.FieldByName(AColumn.caption).AsString + ','      else        sqlstr := sqlstr + 'NULL,';    except        showmessage('Excel文件有误,导入失败。');        exit;    end;end;