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

Annotation of /FigKernelPackages/ErrorMessage.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (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 :    
25 :     =head1 Error Message Object
26 :    
27 :     =head2 Introduction
28 :    
29 :     The error message object is a simple class object that describes a server error. It
30 :     replaces the deprecated B<ErrorDocument> class. It contains a short message for
31 :     display purposes and a long message with detailed information. When the object
32 :     is stringified, the short message is returned.
33 :    
34 :     The fields in this object are as follows.
35 :    
36 :     =over 4
37 :    
38 :     =item message
39 :    
40 :     detailed message describing the error
41 :    
42 :     =item baseMessage
43 :    
44 :     message describing the kind of error
45 :    
46 :     =back
47 :    
48 :     =cut
49 :    
50 :     =head3 new
51 :    
52 :     my $errDoc = ErrorMessage->new($message, $baseMessage);
53 :    
54 :     Construct a new ErrorMessage object. The following parameters are expected.
55 :    
56 :     =over 4
57 :    
58 :     =item message
59 :    
60 :     Text of the detailed error message. The detailed error message is long, and frequently
61 :     contains information about where the error occurred and the contents of the call stack.
62 :    
63 :     =item baseMessage
64 :    
65 :     Text of the user-friendly error message. The user-friendly message is short, and
66 :     designed to be minimally confusing; it is also minimally informative.
67 :    
68 :    
69 :     =back
70 :    
71 :     =cut
72 :    
73 :     sub new {
74 :     # Get the parameters.
75 :     my ($class, $message, $baseMessage) = @_;
76 :     # Clean the message.
77 :     my $cleaned = $message;
78 :     chomp $cleaned;
79 :     # Create the ErrorMessage object.
80 :     my $retVal = {
81 :     message => $cleaned,
82 :     baseMessage => $baseMessage,
83 :     };
84 :     # Bless and return it.
85 :     bless $retVal, $class;
86 :     return $retVal;
87 :     }
88 :    
89 :     =head2 Public Methods
90 :    
91 :     =head3 message
92 :    
93 :     my $text = $errDoc->message();
94 :    
95 :     Return the error message.
96 :    
97 :     =cut
98 :    
99 :     sub message {
100 :     # Get the parameters.
101 :     my ($self) = @_;
102 :     # Return the result.
103 :     return $self->{message};
104 :     }
105 :    
106 :     =head3 baseMessage
107 :    
108 :     my $text = $errDoc->baseMessage();
109 :    
110 :     Return the user-friendly error message.
111 :    
112 :     =cut
113 :    
114 :     sub baseMessage {
115 :     # Get the parameters.
116 :     my ($self) = @_;
117 :     # Return the result.
118 :     return $self->{baseMessage};
119 :     }
120 :    
121 :    
122 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3