1 USING: help.syntax help.markup words ;
\r
5 { $syntax "DESCRIPTIVE: word ( inputs -- outputs ) definition ;" }
\r
6 { $description "Defines a word such that, if an error is thrown from within it, that error is wrapped in a " { $link descriptive-error } " with the arguments to that word." } ;
\r
9 { $syntax "DESCRIPTIVE:: word ( inputs -- outputs ) definition ;" }
\r
10 { $description "Defines a word which uses locals such that, if an error is thrown from within it, that error is wrapped in a " { $link descriptive-error } " with the arguments to that word." } ;
\r
12 HELP: descriptive-error
\r
13 { $error-description "The class of errors wrapping another error (in the underlying slot) which were thrown in a word (in the word slot) with a given set of arguments (in the args slot)." } ;
\r
15 HELP: make-descriptive
\r
16 { $values { "word" word } }
\r
17 { $description "Makes the word wrap errors in " { $link descriptive-error } " instances." } ;
\r
19 ARTICLE: "descriptive" "Descriptive errors"
\r
20 "This vocabulary defines automatic descriptive errors. Using it, you can define a word which acts as normal, except when it throws an error, the error is wrapped in an instance of a class:"
\r
21 { $subsections descriptive-error }
\r
22 "The wrapper contains the word itself, the input parameters, as well as the original error."
\r
24 "To annotate an existing word with descriptive error checking:"
\r
25 { $subsections make-descriptive }
\r
26 "To define words which throw descriptive errors, use the following words:"
\r
28 POSTPONE: DESCRIPTIVE:
\r
29 POSTPONE: DESCRIPTIVE::
\r
32 ABOUT: "descriptive"
\r