跳轉到內容

Rebol 程式設計/throw-error

來自華夏公益教科書,開放的書籍,為開放的世界
THROW-ERROR err-type err-id args 

使用提供的的資訊立即丟擲錯誤。

THROW-ERROR 是一個函式值。

  • err-type -- (型別:詞語)
  • err-id -- (型別:詞語)
  • args -- (型別:任何)

原始碼

[編輯 | 編輯原始碼]
throw-error: func [
    {Causes an immediate error throw with the provided information.} 
    err-type [word!] 
    err-id [word!] 
    args
][
    parse args: compose [(:args)] [0 3 [args: any-function! (
                change/only args copy/deep third first args
            ) | skip]] 
    args: head args 
    throw make error! reduce [err-type err-id pick args 1 pick args 2 pick args 3]
]
華夏公益教科書