blob: 835d6a569cb0be74d5f3e92b2ee8529bd36c8177 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstra7ea4a032019-11-26 20:11:40 +01002 void runtime_error( string err, string prg, string curobj, int line
3 , mixed culprit, int caught)
MG Mud User88f12472016-06-24 23:31:02 +02004
5DESCRIPTION
Zesstra7ea4a032019-11-26 20:11:40 +01006 This function has to announce a runtime error to the active
7 user. If the user has enough privileges, it might give him the
8 full error message together with the source line. Else it
9 should issue a decent message ("Your sensitive mind notices a
10 wrongness in the fabric of space").
MG Mud User88f12472016-06-24 23:31:02 +020011
Zesstra7ea4a032019-11-26 20:11:40 +010012 <err> is the error message, <prg> is the program executed (which
13 might be an inherited program), <curobj> is the current object at
14 the time of the error. <line> is the linenumber within the program.
15
16 If the error is a normal runtime error, <culprit> is -1. Otherwise,
17 the error occurred during a heartbeat and <culprit> is the object which
18 heart_beat() function was executed. Also, in case of a heartbeat error,
19 the heartbeat for the <culprit> has been turned off.
20
21 If the error is caught on a higher level, <caught> is non-zero;
22 otherwise it is 0.
23
24 Note that any of the the objects or programs might be destructed, ie.
25 might be passed as 0.
26
27 One common pitfall in the implementation of runtime_error() is
28 that runtime_error() itself could run out of evaluation ticks,
29 causing a runtime error itself. The workaround is to use
30 limited() like this:
31
32 static void
33 handle_runtime_error ( string err, string prg, string curobj
34 , int line)
35 { ... the actual error handler ... }
36
37 static void
38 call_runtime_error (string err, string prg, string curobj, int line)
39 {
40 limited(#'handle_runtime_error, ({ 200000 }), err, prg, curobj
41 , line);
42 }
43
44 void
45 runtime_error (string err, string prg, string curobj, int line)
46 {
47 limited(#'call_runtime_error, ({ LIMIT_UNLIMITED })
48 , err, prg, curobj, line);
49 }
50
51HISTORY
52 LDMud 3.2.9 added the <culprit> argument.
53 LDMud 3.2.12/3.3.705 added the <caught> argument.
MG Mud User88f12472016-06-24 23:31:02 +020054
55SEE ALSO
Zesstra7ea4a032019-11-26 20:11:40 +010056 log_error(M), heart_beat_error(M), runtime_warning(M),
57 raise_error(E), expand_define(E)