File tree Expand file tree Collapse file tree 3 files changed +50
-1
lines changed
Expand file tree Collapse file tree 3 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,49 @@ document {
327327 }
328328 }
329329
330+ doc ///
331+ Key
332+ Error
333+ Headline
334+ error information
335+ Description
336+ Text
337+ An instance of this class is a hash table containing the position and
338+ message of an error caught by @TO symbol attempt@.
339+ Example
340+ attempt 1 /0
341+ SeeAlso
342+ symbol attempt
343+ ///
344+
345+ doc ///
346+ Key
347+ symbol attempt
348+ Headline
349+ attempt to evaluate code and get information about any errors that occur
350+ Usage
351+ attempt c
352+ Description
353+ Text
354+ The code @VAR " c" @ is evaluated. If the evaluation completes
355+ successfully, then the value is returned.
356+ Example
357+ attempt 5
358+ Text
359+ If an error occurs, then an @TO Error@ object containing information
360+ about the error is returned.
361+ Example
362+ attempt 1 /0
363+ Text
364+ Note that this is a @TO Keyword @, not a method , and so it is not
365+ necessary to enclose @VAR " c" @ in parentheses.
366+ Example
367+ attempt 5 == " foo"
368+ {attempt error " bar" , 1 /2}
369+ attempt 1 /0; 1 /2
370+ SeeAlso
371+ symbol try
372+ ///
330373
331374document {
332375 Key => " recursionLimit" ,
Original file line number Diff line number Diff line change @@ -704,6 +704,8 @@ document {
704704 TO " error" ,
705705 TO " try" ,
706706 TO " throw" ,
707+ TO " attempt" ,
708+ TO " Error" ,
707709 }
708710 }
709711
@@ -733,7 +735,8 @@ document {
733735 " The behavior of interrupts (other than alarms) is unaffected." ,
734736 EXAMPLE " apply(-3..3,i->try 1/i else infinity)" ,
735737 Caveat => " We will change the behavior of this function soon so that it will be possible to catch errors of a particular type. Meanwhile, users are
736- recommended to use this function sparingly, if at all."
738+ recommended to use this function sparingly, if at all." ,
739+ SeeAlso => {" attempt" },
737740 }
738741
739742document {
Original file line number Diff line number Diff line change 1+ err = attempt error " foo"
2+ assert Equation (err#" message" , " foo" )
3+
14stderr << " --testing the error messages must be done manually" << endl
25end
36
You can’t perform that action at this time.
0 commit comments