Rebol 程式設計/throw-on-error
外觀
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
]