- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有没有类似于php中的try catch的方法?
try {
...
}
catch (Exception $e) {
...
}
DO ON ERROR UNDO ...
但我想知道是否有另一种方法可以做到。
最佳答案
是的。从 11.2 版开始,就有 BLOCK-LEVEL ON ERROR UNDO, THROW.
更改整个程序的默认行为的语句。 CATCH
已经存在了更长的时间 - 从 10.1C 版开始。
/* Must be first line of program */
BLOCK-LEVEL ON ERROR UNDO, THROW.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
i = INTEGER("Hello").
CATCH err AS Progress.Lang.Error:
MESSAGE "Error: " err:GetMessage(1)
VIEW-AS ALERT-BOX ERROR.
END.
老式程序,如您的示例,取自
Progress KnowledgeBase .
DO ON ERROR UNDO, THROW:
/* The following line raises error (138) which is diverted to a Progress.Lang.SysError object and thrown to the main block. */
FIND Customer 1000.
END.
CATCH eAnyError AS Progress.Lang.Error:
MESSAGE
"Error Number:~t" eAnyError:GetMessageNum(1) "~n"
"Error Text:~t" eAnyError:GetMessage(1)
VIEW-AS ALERT-BOX BUTTONS OK TITLE "Error processing in the CATCH for mainprocedure block".
END CATCH.
错误撤销、抛出的块级完整描述
Syntax BLOCK-LEVEL ON ERROR UNDO, THROW.
This statement affects the following block types:
Main block of an external procedure (.p)
Internal procedures
User-defined functions
Methods of a class
Class constructors
Property accessors
ON blocks used as database triggers with CREATE, DELETE, WRITE orASSIGN events
REPEAT blocks
FOR blocks
DO TRANSACTION blocks
This statement does not affect:
DestructorsError directives that are explicitly coded in individual, non routine-level blocks
ON blocks that are UI triggers.
Note these alternatives to the BLOCK-LEVEL ON ERROR UNDO, THROWstatement:
Instead of adding the statement to source-code files, youcan use the -undothrow 2 startup parameter to change the defaulterror-handling to UNDO, THROW on every block affected by theBLOCK-LEVEL statement during compilation. See the Startup Command andParameter Reference for more information.The ROUTINE-LEVEL ON ERROR UNDO, THROW statement can be used if youwant to change the default error-handling only on routine-levelblocks. (You can use the -undothrow 1 startup parameter to change thedefault error-handling on routine-level blocks to UNDO, THROW duringcompilation.)
关于progress-4gl - try catch 进行中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23127756/
这对我来说似乎很简单,但我找不到合适的属性。出于错误报告的目的,我想知道我所在的内部过程的名称。 这是最简单的示例: 运行测试。 程序测试。 /* 如何在此处显示过程名称“test”? */ 结束程序
虽然这不是我的主要职责,但我从事 Progress 4GL 已经 8 年了。我更多地使用 C++ 和 Java。当用其他语言编程时,建议声明接近用法。然而,对于 4GL,我看到人们将声明放在文件的顶部
我注意到 Progress 4gl 中的 IF 语句有一个非常奇怪的行为。 我定义了一个格式为“999”的整数,它告诉它有 3 位数字,然后我分配一个小于 100 的值(例如 12),然后当我显示它时
我有下面的代码片段(如之前的 Stack Overflow 回答... Deleting all special characters from a string in progress 4GL 中所
如何将数字和字符串添加到 Progress4GL 上的字符变量中 如下所示(这只是一个展示想法的例子)。 a = 'Code' b = 1 c = a+b 所以c的值为“Code1” 我怎样才能在pr
我有一个缓冲区,其中混合了数据、数字和字符字段。我正在显示字段的值,但由于某种原因,日期字段返回“?”当我尝试将它们添加到字符串时。 我还明白吗?即使我这样做 ASSIGN lvString = lv
有没有办法用特定字符格式化正在进行的字符串? 一个示例显示了前 6 个数字为 x 的 SSN。我已尝试使用 String 函数,但它不支持以格式发送的字母 x。 SSNString = '333224
我正在寻找好的文献来学习 Progress 4GL。这是一个与工作空间相关的项目,无法获得培训资金。我试过文档,但它不准确且相当困惑。 我将不得不在 OE 10.1B 上的 ChUI 中完成大部分工作
我如何计算总数?表中的记录?我想显示数据库中的所有表名以及编号。每个表中的记录数 最佳答案 最快的方法是: proutil dbname -C tabanalys > dbname.tab 这是一个分
我正在创建某种音频播放器,但遇到了障碍。我添加了一个进度条,它会根据正在播放的歌曲进行更新。 但是,我希望进度条可以点击并在点击时跳转到轨道的时间(就像每个普通玩家一样)。
在我的进度应用程序中使用浏览器时,滚动条永远不会正常工作。它会显示我只能向下滚动一点,然后继续前进。这是一个正在进行的错误还是我可以做些什么来解决这个问题? /* Connected Database
我们如何更改 Progress 中的默认锁而不是共享锁? 最佳答案 您可以通过使用 [NO|EXCLUSIVE|SHARE]-LOCK 修饰符将锁定状态添加到查询来在每个单独的查询(FIND、FOR
我正在使用 Material-UI的 默认情况下转换 scaleX() 的组件 的属性在另一个里面 每当值更改以可视化当前进度时。它具有缓动效果,使一切看起来都很流畅,这通常非常好,但是出于我的应用程
我很好奇 PWA 添加到主屏幕后将在后台使用什么浏览器。它是您最初选择“添加到主屏幕”的那个吗?如果是,如果我在我的 Chrome 上将 PWA 添加到主屏幕怎么办手机,然后删除 Chrome(假设现
在我问任何问题之前,让我告诉你我对 Progress Openedge 没有任何经验,但我的公司运行一个用它制作的应用程序,现在我必须通过它进行一些 SOAP 调用。所以我想,为什么不调用用我认为合适
在我提出任何问题之前,让我告诉你我对 Progress Openedge 没有任何经验,但我的公司运行一个用它制作的应用程序,现在我必须通过它进行一些 SOAP 调用。所以我想,为什么不调用用我认为合
进度处理程序已在一些领先的 promise 库(Q、When、Bluebird)中弃用,并且也已从新的 Promises/A+ spec 中删除。虽然我理解取消进度事件背后的原因,但我在重构以下我
如何改变的颜色 progress[value]::-webkit-progress-value { background-color: #00bdf8;
我有一个需要连接的进度数据库。它们与 SQL Server Management Studio 的等价物是什么? 服务器似乎是 Progress OpenEdge 10.1 最佳答案 这在一定程度上取
我在不了解 PWA 的内在含义的情况下开始构建 PWA。当我搜索时,PWA 使用以下技术逐步为 Web 应用程序提供了类似于外观的原生应用程序 舱单 服务人员 设计App shell Web 应用程序
我是一名优秀的程序员,十分优秀!