Filename | /var/www/foswiki11/lib/Foswiki/EngineException.pm |
Statements | Executed 8 statements in 167µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 12µs | 25µs | BEGIN@16 | Foswiki::EngineException::
1 | 1 | 1 | 8µs | 14µs | BEGIN@17 | 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 | 25µs | 2 | 38µs | # spent 25µs (12+13) within Foswiki::EngineException::BEGIN@16 which was called:
# once (12µs+13µs) by Foswiki::UI::BEGIN@157 at line 16 # spent 25µs making 1 call to Foswiki::EngineException::BEGIN@16
# spent 13µs making 1 call to strict::import |
17 | 2 | 21µs | 2 | 19µs | # spent 14µs (8+5) within Foswiki::EngineException::BEGIN@17 which was called:
# once (8µs+5µs) by Foswiki::UI::BEGIN@157 at line 17 # spent 14µs making 1 call to Foswiki::EngineException::BEGIN@17
# spent 5µs making 1 call to warnings::import |
18 | |||||
19 | 2 | 110µs | 1 | 3µs | # spent 3µs within Foswiki::EngineException::BEGIN@19 which was called:
# once (3µs+0s) by Foswiki::UI::BEGIN@157 at line 19 # spent 3µs making 1 call to Foswiki::EngineException::BEGIN@19 |
20 | 1 | 7µs | our @ISA = ('Error'); | ||
21 | |||||
22 | =begin TML | ||||
23 | |||||
24 | ---+ ClassMethod new( $status, $reason [, $response] ) | ||||
25 | |||||
26 | * =$status= - status code to send to client | ||||
27 | * =$reason= - string reason for failure | ||||
28 | * =$response= - custom Foswiki::Response object to be sent to client. Optional. | ||||
29 | |||||
30 | All the above fields are accessible from the object in a catch clause | ||||
31 | in the usual way e.g. =$e->{status}= and =$e->{reason}= | ||||
32 | |||||
33 | =cut | ||||
34 | |||||
35 | sub new { | ||||
36 | my ( $class, $status, $reason, $response ) = @_; | ||||
37 | |||||
38 | return $class->SUPER::new( | ||||
39 | status => $status, | ||||
40 | reason => $reason, | ||||
41 | response => $response | ||||
42 | ); | ||||
43 | } | ||||
44 | |||||
45 | =begin TML | ||||
46 | |||||
47 | ---++ ObjectMethod stringify() -> $string | ||||
48 | |||||
49 | Generate a summary string. This is mainly for debugging. | ||||
50 | |||||
51 | =cut | ||||
52 | |||||
53 | sub stringify { | ||||
54 | my $this = shift; | ||||
55 | return | ||||
56 | qq(EngineException: Status code "$this->{status}" defined because of "$this->{reason}".); | ||||
57 | } | ||||
58 | |||||
59 | 1 | 3µs | 1; | ||
60 | __END__ |