Rebol 编程/throw-on-error
外观
< Rebol 编程
THROW-ON-ERROR blk
评估一个块,如果它导致错误,则抛出该错误。
THROW-ON-ERROR 是一个函数值。
- blk -- (类型:块)
- 抛出
throw-on-error: func [
{Evaluates a block, which if it results in an error, throws that error.}
[throw]
blk [block!]
][
if error? set/any 'blk try blk [throw blk]
get/any 'blk
]