首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ada -在何处定义Verbosity_Desired?

Ada -在何处定义Verbosity_Desired?
EN

Stack Overflow用户
提问于 2019-01-11 06:10:55
回答 1查看 54关注 0票数 1

我正在研究Ada中异常处理的this example

要为Verbosity_Desired执行with需要做些什么

代码语言:javascript
复制
   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;
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-11 06:50:37

在我看来你不需要with任何东西...这可能只是为了展示,也许Verbosity_Desired是一个布尔值,您可以自己定义。

来自LRM的这个示例是关于异常以及如何获取有关它们的信息,所以它可能只是演示了通过使用Exceptions.Exception_Information可以获得更多的详细信息。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54137632

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档