[Bio] / FigKernelPackages / ErrorMessage.pm Repository:
ViewVC logotype

Annotation of /FigKernelPackages/ErrorMessage.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : parrello 1.1 # This is a SAS Component.
2 :    
3 :     #
4 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
5 :     # for Interpretations of Genomes. All Rights Reserved.
6 :     #
7 :     # This file is part of the SEED Toolkit.
8 :     #
9 :     # The SEED Toolkit is free software. You can redistribute
10 :     # it and/or modify it under the terms of the SEED Toolkit
11 :     # Public License.
12 :     #
13 :     # You should have received a copy of the SEED Toolkit Public License
14 :     # along with this program; if not write to the University of Chicago
15 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
16 :     # Genomes at veronika@thefig.info or download a copy from
17 :     # http://www.theseed.org/LICENSE.TXT.
18 :     #
19 :    
20 :     package ErrorMessage;
21 :    
22 :     use strict;
23 :     use overload '""' => "baseMessage";
24 :     use CGI;
25 :    
26 :     =head1 Error Message Object
27 :    
28 :     =head2 Introduction
29 :    
30 :     The error message object is a simple class object that describes a server error. It
31 :     replaces the deprecated B<ErrorDocument> class. It contains a short message for
32 :     display purposes and a long message with detailed information. When the object
33 :     is stringified, the short message is returned.
34 :    
35 :     The fields in this object are as follows.
36 :    
37 :     =over 4
38 :    
39 :     =item message
40 :    
41 :     detailed message describing the error
42 :    
43 :     =item baseMessage
44 :    
45 :     message describing the kind of error
46 :    
47 :     =back
48 :    
49 :     =cut
50 :    
51 :     =head3 new
52 :    
53 :     my $errDoc = ErrorMessage->new($message, $baseMessage);
54 :    
55 :     Construct a new ErrorMessage object. The following parameters are expected.
56 :    
57 :     =over 4
58 :    
59 :     =item message
60 :    
61 :     Text of the detailed error message. The detailed error message is long, and frequently
62 :     contains information about where the error occurred and the contents of the call stack.
63 :    
64 :     =item baseMessage
65 :    
66 :     Text of the user-friendly error message. The user-friendly message is short, and
67 :     designed to be minimally confusing; it is also minimally informative.
68 :    
69 :    
70 :     =back
71 :    
72 :     =cut
73 :    
74 :     sub new {
75 :     # Get the parameters.
76 :     my ($class, $message, $baseMessage) = @_;
77 :     # Clean the message.
78 :     my $cleaned = $message;
79 :     chomp $cleaned;
80 :     # Create the ErrorMessage object.
81 :     my $retVal = {
82 :     message => $cleaned,
83 :     baseMessage => $baseMessage,
84 :     };
85 :     # Bless and return it.
86 :     bless $retVal, $class;
87 :     return $retVal;
88 :     }
89 :    
90 :     =head2 Public Methods
91 :    
92 :     =head3 message
93 :    
94 :     my $text = $errDoc->message();
95 :    
96 :     Return the error message.
97 :    
98 :     =cut
99 :    
100 :     sub message {
101 :     # Get the parameters.
102 :     my ($self) = @_;
103 :     # Return the result.
104 :     return $self->{message};
105 :     }
106 :    
107 :     =head3 baseMessage
108 :    
109 :     my $text = $errDoc->baseMessage();
110 :    
111 :     Return the user-friendly error message.
112 :    
113 :     =cut
114 :    
115 :     sub baseMessage {
116 :     # Get the parameters.
117 :     my ($self) = @_;
118 :     # Return the result.
119 :     return $self->{baseMessage};
120 :     }
121 :    
122 :    
123 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3