Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/EngineException.pm |
Statements | Executed 8 statements in 323µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 35µs | 42µs | BEGIN@16 | Foswiki::EngineException::
1 | 1 | 1 | 17µs | 34µs | BEGIN@17 | Foswiki::EngineException::
1 | 1 | 1 | 9µs | 9µ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 | 47µs | 2 | 50µs | # spent 42µs (35+7) within Foswiki::EngineException::BEGIN@16 which was called:
# once (35µs+7µs) by Foswiki::UI::BEGIN@157 at line 16 # spent 42µs making 1 call to Foswiki::EngineException::BEGIN@16
# spent 8µs making 1 call to strict::import |
17 | 2 | 44µs | 2 | 52µs | # spent 34µs (17+18) within Foswiki::EngineException::BEGIN@17 which was called:
# once (17µs+18µs) by Foswiki::UI::BEGIN@157 at line 17 # spent 34µs making 1 call to Foswiki::EngineException::BEGIN@17
# spent 18µs making 1 call to warnings::import |
18 | |||||
19 | 2 | 215µs | 1 | 9µs | # spent 9µs within Foswiki::EngineException::BEGIN@19 which was called:
# once (9µs+0s) by Foswiki::UI::BEGIN@157 at line 19 # spent 9µs making 1 call to Foswiki::EngineException::BEGIN@19 |
20 | 1 | 11µ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 | 7µs | 1; | ||
60 | __END__ |