REBOL Programming/throw-on-error

< REBOL Programming

USAGE:

THROW-ON-ERROR blk 

DESCRIPTION:

Evaluates a block, which if it results in an error, throws that error.

THROW-ON-ERROR is a function value.

ARGUMENTS

(SPECIAL ATTRIBUTES)

SOURCE CODE

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
]
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.