5
* <p>class Message - A simple class for representing a message. The Constructor is designed to
6
* receiver common throw messages from pike. Otherwise a Message is designed as follows:
7
* 1. msg: Message as string,
8
* 2. backtrace: Output from function backtrace()
9
* 3. errorcode: The error id (see MessageCode for details)
10
* 4. about: The id of the item the message deals about </p>
14
* <p>Constant for error</p>
16
public constant ERROR = 1;
19
* <p>Constant for warning</p>
21
public constant WARNING = 2;
24
* <p>Constant for status</p>
26
public constant STATUS = 3;
29
* <p>The errorcode of the message (see MessageCode for details)</p>
31
public int errorcode = 0;
33
* <p>The type of the message, either ERROR, WARNING or STATUS</p>
38
* <p>The message to send</p>
43
* <p>the backtrace of the message</p>
45
public string backtrace="";
48
* <p>The id resp. item id the message is about.</p>
50
public string about="";
55
* <p>Constructor for the Message</p>
57
* accepts array of this form ({ string, backtrace(),int,stirng}) );
58
* @example throw( ({ "My Message", backtrace(),11,"id_of_item"}) );
59
* @param msg - the array with the informations
60
* @param msg - the message
61
* @param about - the id about the message deals
63
public void create(array msg) {
65
this_program::msg= (string)msg[0];
66
backtrace=sprintf("%O",msg[1]);
69
this_program::errorcode = msg[2];
75
this_program::about = msg[3];
81
* <p>Renders a string represenation of the message</p>
84
* @return string with the dump
86
public string to_string() {
96
message_type="Warning";
100
message_type="Status";
103
return "\n\n"+message_type+"------------------------------\n"+
104
"Messagecode: "+errorcode+"\n Message: "+msg+"\n About:"+about+"\n Backtrace:"+backtrace+
105
"\n------------------------------\n";
110
* <p>Indictas wheter this message is an errormessage or not</p>
115
public int is_error()