|
Lines 1-3
Link Here
|
|
|
1 |
# This file is part of Koha. |
| 2 |
# |
| 3 |
# Copyright (C) YEAR YOURNAME-OR-YOUREMPLOYER |
| 4 |
# |
| 5 |
# Koha is free software; you can redistribute it and/or modify it |
| 6 |
# under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# Koha is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
| 1 |
package Koha::Exceptions::File; |
18 |
package Koha::Exceptions::File; |
| 2 |
|
19 |
|
| 3 |
use Modern::Perl; |
20 |
use Modern::Perl; |
|
Lines 11-27
use Koha::Exceptions;
Link Here
|
| 11 |
use Exception::Class ( |
28 |
use Exception::Class ( |
| 12 |
|
29 |
|
| 13 |
'Koha::Exceptions::File' => { |
30 |
'Koha::Exceptions::File' => { |
| 14 |
isa => 'Koha::Exceptions::Exception', |
31 |
'isa' => 'Koha::Exceptions::Exception', |
| 15 |
description => 'Problem with a file', |
32 |
'description' => 'Problem with a file', |
| 16 |
fields => ['path', 'stat'], |
33 |
'fields' => ['path', 'stat'], |
| 17 |
}, |
34 |
}, |
| 18 |
); |
35 |
); |
| 19 |
|
36 |
|
| 20 |
=head2 throw |
37 |
=head1 NAME |
| 21 |
@OVERLOADS |
38 |
|
|
|
39 |
Koha::Exceptions::File |
| 40 |
|
| 41 |
=head1 SYNOPSIS |
| 22 |
|
42 |
|
| 23 |
Adds diagnostic information regarding the file with issues |
43 |
Adds diagnostic information regarding the file with issues |
| 24 |
|
44 |
|
|
|
45 |
=head1 AUTHOR |
| 46 |
|
| 47 |
Olli-Antti Kivilahti |
| 48 |
|
| 49 |
=head1 LICENSE |
| 50 |
|
| 51 |
GPL v3 |
| 52 |
|
| 53 |
=head1 DESCRIPTION |
| 54 |
|
| 55 |
This file defines exceptions for Koha based on system files. |
| 56 |
It does this by overloading the throw method with diagnostic |
| 57 |
information. |
| 58 |
|
| 59 |
=head1 SUBROUTINES/METHODS |
| 60 |
|
| 61 |
=head2 throw |
| 62 |
|
| 63 |
my $file_exception = Koha::Exceptions::File->new(); |
| 64 |
$file_exception->throw(%args); |
| 65 |
|
| 25 |
=cut |
66 |
=cut |
| 26 |
|
67 |
|
| 27 |
sub throw { |
68 |
sub throw { |
|
Lines 46-51
sub throw {
Link Here
|
| 46 |
|
87 |
|
| 47 |
$args{error} .= '. '.$stat; |
88 |
$args{error} .= '. '.$stat; |
| 48 |
$self->SUPER::throw(%args); |
89 |
$self->SUPER::throw(%args); |
|
|
90 |
return; |
| 49 |
} |
91 |
} |
| 50 |
|
92 |
|
| 51 |
1; |
93 |
1; |