我正在研究Ada中异常处理的this example。
要为Verbosity_Desired执行with需要做些什么
with Ada.Text_IO;
with Ada.Exceptions;
with File_System; use File_System;
use Ada;
procedure Main is
begin
... -- call operations in File_System
exception
when End_Of_File =>
Close(Some_File);
when Not_Found_Error : File_Not_Found =>
Text_IO.Put_Line(Exceptions.Exception_Message(Not_Found_Error));
when The_Error : others =>
Text_IO.Put_Line("Unknown error:");
if Verbosity_Desired then
Text_IO.Put_Line(Exceptions.Exception_Information(The_Error));
else
Text_IO.Put_Line(Exceptions.Exception_Name(The_Error));
Text_IO.Put_Line(Exceptions.Exception_Message(The_Error));
end if;
raise;
end Main;发布于 2019-01-11 06:50:37
在我看来你不需要with任何东西...这可能只是为了展示,也许Verbosity_Desired是一个布尔值,您可以自己定义。
来自LRM的这个示例是关于异常以及如何获取有关它们的信息,所以它可能只是演示了通过使用Exceptions.Exception_Information可以获得更多的详细信息。
https://stackoverflow.com/questions/54137632
复制相似问题