Filename | /var/www/foswikidev/core/lib/Foswiki/EngineException.pm |
Statements | Executed 9 statements in 209µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 12µs | 25µs | BEGIN@16 | Foswiki::EngineException::
1 | 1 | 1 | 9µs | 13µs | BEGIN@17 | Foswiki::EngineException::
1 | 1 | 1 | 4µs | 4µs | BEGIN@22 | Foswiki::EngineException::
1 | 1 | 1 | 3µs | 3µs | BEGIN@19 | Foswiki::EngineException::
0 | 0 | 0 | 0s | 0s | new | Foswiki::EngineException::
0 | 0 | 0 | 0s | 0s | stringify | Foswiki::EngineException::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | |||||
3 | =begin TML | ||||
4 | |||||
5 | ---+ package Foswiki::EngineException | ||||
6 | |||||
7 | Exception used to raise an engine related error. This exception has the | ||||
8 | following fields: | ||||
9 | * =status= - status code to send to client | ||||
10 | * =reason= a text string giving the reason for the refusal. | ||||
11 | |||||
12 | =cut | ||||
13 | |||||
14 | package Foswiki::EngineException; | ||||
15 | |||||
16 | 2 | 30µs | 2 | 37µs | # spent 25µs (12+12) within Foswiki::EngineException::BEGIN@16 which was called:
# once (12µs+12µs) by Foswiki::UI::BEGIN@173 at line 16 # spent 25µs making 1 call to Foswiki::EngineException::BEGIN@16
# spent 12µs making 1 call to strict::import |
17 | 2 | 22µs | 2 | 17µs | # spent 13µs (9+4) within Foswiki::EngineException::BEGIN@17 which was called:
# once (9µs+4µs) by Foswiki::UI::BEGIN@173 at line 17 # spent 13µs making 1 call to Foswiki::EngineException::BEGIN@17
# spent 4µs making 1 call to warnings::import |
18 | |||||
19 | 2 | 50µs | 1 | 3µs | # spent 3µs within Foswiki::EngineException::BEGIN@19 which was called:
# once (3µs+0s) by Foswiki::UI::BEGIN@173 at line 19 # spent 3µs making 1 call to Foswiki::EngineException::BEGIN@19 |
20 | 1 | 6µs | our @ISA = ('Error'); | ||
21 | |||||
22 | # spent 4µs within Foswiki::EngineException::BEGIN@22 which was called:
# once (4µs+0s) by Foswiki::UI::BEGIN@173 at line 27 | ||||
23 | 1 | 4µs | if ( $Foswiki::cfg{UseLocale} ) { | ||
24 | require locale; | ||||
25 | import locale(); | ||||
26 | } | ||||
27 | 1 | 95µs | 1 | 4µs | } # spent 4µs making 1 call to Foswiki::EngineException::BEGIN@22 |
28 | |||||
29 | =begin TML | ||||
30 | |||||
31 | ---+ ClassMethod new( $status, $reason [, $response] ) | ||||
32 | |||||
33 | * =$status= - status code to send to client | ||||
34 | * =$reason= - string reason for failure | ||||
35 | * =$response= - custom Foswiki::Response object to be sent to client. Optional. | ||||
36 | |||||
37 | All the above fields are accessible from the object in a catch clause | ||||
38 | in the usual way e.g. =$e->{status}= and =$e->{reason}= | ||||
39 | |||||
40 | =cut | ||||
41 | |||||
42 | sub new { | ||||
43 | my ( $class, $status, $reason, $response ) = @_; | ||||
44 | |||||
45 | return $class->SUPER::new( | ||||
46 | status => $status, | ||||
47 | reason => $reason, | ||||
48 | response => $response | ||||
49 | ); | ||||
50 | } | ||||
51 | |||||
52 | =begin TML | ||||
53 | |||||
54 | ---++ ObjectMethod stringify() -> $string | ||||
55 | |||||
56 | Generate a summary string. This is mainly for debugging. | ||||
57 | |||||
58 | =cut | ||||
59 | |||||
60 | sub stringify { | ||||
61 | my $this = shift; | ||||
62 | return | ||||
63 | qq(EngineException: Status code "$this->{status}" defined because of "$this->{reason}".); | ||||
64 | } | ||||
65 | |||||
66 | 1 | 3µs | 1; | ||
67 | __END__ |