Mercurial > pub > Impl
annotate Lib/IMPL/Web/Exception.pm @ 321:3dc9260017ad
Added JSON support for the request action
author | cin |
---|---|
date | Mon, 20 May 2013 01:14:27 +0400 |
parents | 4ddb27ff4a0b |
children | b56b1ec33b59 |
rev | line source |
---|---|
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
1 package IMPL::Web::Exception; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
2 use strict; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
3 use warnings; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
4 |
230 | 5 use IMPL::Const qw(:prop); |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
6 use IMPL::declare { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
7 base => [ |
278 | 8 'IMPL::AppException' => '@_' |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
9 ], |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
10 props => [ |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
11 headers => PROP_ALL |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
12 ] |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
13 }; |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
14 |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
15 sub status { |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
16 "500 Internal error"; |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
17 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
18 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
19 1; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
20 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
21 __END__ |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
22 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
23 =pod |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
24 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
25 =head1 NAME |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
26 |
206 | 27 C<IMPL::Web::Exception> - Базовый класс для всех web-исключений, для ошибок вызванных |
28 по вине клиента. | |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
29 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
30 =head1 SYNOPSIS |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
31 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
32 Вызов исключения |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
33 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
34 =begin code |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
35 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
36 use IMPL::require { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
37 WebException => 'IMPL::Web::WebException' |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
38 }; |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
39 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
40 sub MyWebHandler { |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
41 # ... |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
42 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
43 die WebException->new("something is wrong"); |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
44 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
45 # ... |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
46 } |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
47 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
48 =end code |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
49 |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
50 =head1 MEMBERS |
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
51 |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
52 =head2 C<status()> |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
53 |
206 | 54 Возвращает C<HTTP> код ошибки. Каждый класс иключений должен переопределить данный метод. |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
55 |
229
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
56 =head2 C<[get,set]headers> |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
57 |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
58 Ссылка на хеш с параметрами заголовка. |
47f77e6409f7
heavily reworked the resource model of the web application:
sergey
parents:
206
diff
changeset
|
59 |
197
6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
sergey
parents:
diff
changeset
|
60 =cut |