关于try..except ..on ?? do ...end; (30分)

  • 主题发起人 主题发起人 fossil
  • 开始时间 开始时间
F

fossil

Unregistered / Unconfirmed
GUEST, unregistred user!
写文件错误,因该属于那种异常处理方式
try
...
except on ????do
end;
 
what's mean?
 
EWriteError
 
有这个TRL异常情况吗???????????????EWriteError
 
有呀
EWriteError is the exception class for unsuccessful attempts to write data to a stream.
Unit
classes
Description
EWriteError is raised when:
The WriteBuffer method of a stream object is unable to write the specified number of bytes.
The IDE is unable to write one of a component抯 properties to a stream. This can occur when you try to save a form at design time.
 
在Help里查詢一下,不要這麼懶
 
小弟写程序比较懒喜欢不带错误类型:
try
begin
......
end;
except
begin
......
end;
end;
 
在SysUtils里有各种各样的异常定义。
 
反证你用
TRY
EXCEPT
//错误处理
END;
其实你不用考虑太清楚,反证如果出错应该就会出现在那里!
 
你用这个不就可以知道了吗!!!
try

except
on E:Exception do ShowMessage(E.Message);
end;
 
Up:
支持!
如果你知道怎么样就会引发错误的,上面的方法也是挺好的!
 
对的,Exception是所有dlephi exception的基类,可以光捕捉exception(偷懒而且不需要分开各类异常来处理的话)
 
接受答案了.
 

Similar threads

后退
顶部