File: Error

package info (click to toggle)
rtfm 2.0.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 812 kB
  • ctags: 220
  • sloc: perl: 3,426; sh: 153; makefile: 144
file content (57 lines) | stat: -rw-r--r-- 1,485 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
%# BEGIN LICENSE BLOCK
%# 
%#  Copyright (c) 2002-2003 Jesse Vincent <jesse@bestpractical.com>
%#  
%#  This program is free software; you can redistribute it and/or modify
%#  it under the terms of version 2 of the GNU General Public License 
%#  as published by the Free Software Foundation.
%# 
%#  A copy of that license should have arrived with this
%#  software, but in any event can be snarfed from www.gnu.org.
%# 
%#  This program is distributed in the hope that it will be useful,
%#  but WITHOUT ANY WARRANTY; without even the implied warranty of
%#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%#  GNU General Public License for more details.
%# 
%# END LICENSE BLOCK

<& /RTFM/Elements/Tabs &>
<& /Elements/TitleBoxStart, class=> "error",  title => $Title &>
<%$Why%>
<br>
<font size=-1>
<%$Details%>
</font>
<& /Elements/TitleBoxEnd &>
</body>
</HTML>

<%perl>
$m->abort();
</%perl>
<%args>
$Code => undef
$Details => undef
$Title => loc("RTFM Error")
$Why => loc("the calling component did not specify why")
</%args>

<%INIT>
my $error = "WebRT: $Why ($Details)";

# TODO: Log::Dispatch isn't UTF-8 safe. Autrijus needs to talk to dave rolsky about getting this fixed
if ($] >= 5.007001) {
    require Encode;
    Encode::_utf8_off($error);
}

$RT::Logger->error($error);

if ( $session{'SessionType'} eq 'REST' ) {
    $r->content_type('text/plain');
    $m->out( "Error: " . $Why . "\n" );
    $m->out( $Details . "\n" );
    $m->abort();
}
</%INIT>