From 28665976796ac263caad88d9ac5a4598b1413a31 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Tue, 14 Apr 2015 18:04:59 +0300 Subject: [PATCH] Bug 13995 - Proper Exception handling Koha has issues with propagating errors and exceptions from the business layer to the front-end. Using a more sophisticated system of named Exceptions we can send more formal signals towards the user. Catching different types of Exceptions makes for a more concise handling of errors. Also throwing/catching Exceptions is a industry standard and for a good reason. There is no point for Koha to lurk behind. USAGE: try { Koha::Exception::BadSystemPreference->throw(error => 'Syspref DisplayIconsXSLT is not a valid boolean'); } catch { if (blessed($_) && $_->isa('Koha::Exception::BadSystemPreference')) { print $_->as_string(); warn $_->error, "\n", $_->trace->as_string, "\n"; } else { $_->rethrow(); } } --- C4/Installer/PerlDependencies.pm | 5 +++++ Koha/Exception/BadAuthenticationToken.pm | 28 ++++++++++++++++++++++++ Koha/Exception/BadEncoding.pm | 28 ++++++++++++++++++++++++ Koha/Exception/BadParameter.pm | 28 ++++++++++++++++++++++++ Koha/Exception/BadSystemPreference.pm | 29 +++++++++++++++++++++++++ Koha/Exception/ConnectionFailed.pm | 28 ++++++++++++++++++++++++ Koha/Exception/DuplicateObject.pm | 28 ++++++++++++++++++++++++ Koha/Exception/FeatureUnavailable.pm | 28 ++++++++++++++++++++++++ Koha/Exception/File.pm | 28 ++++++++++++++++++++++++ Koha/Exception/LoginFailed.pm | 28 ++++++++++++++++++++++++ Koha/Exception/Logout.pm | 28 ++++++++++++++++++++++++ Koha/Exception/NoPermission.pm | 28 ++++++++++++++++++++++++ Koha/Exception/NoSystemPreference.pm | 29 +++++++++++++++++++++++++ Koha/Exception/RemoteInvocation.pm | 28 ++++++++++++++++++++++++ Koha/Exception/ServiceTemporarilyUnavailable.pm | 28 ++++++++++++++++++++++++ Koha/Exception/SystemCall.pm | 28 ++++++++++++++++++++++++ Koha/Exception/UnknownObject.pm | 28 ++++++++++++++++++++++++ Koha/Exception/UnknownProgramState.pm | 28 ++++++++++++++++++++++++ Koha/Exception/UnknownProtocol.pm | 28 ++++++++++++++++++++++++ Koha/Exception/VersionMismatch.pm | 28 ++++++++++++++++++++++++ 20 files changed, 539 insertions(+) create mode 100644 Koha/Exception/BadAuthenticationToken.pm create mode 100644 Koha/Exception/BadEncoding.pm create mode 100644 Koha/Exception/BadParameter.pm create mode 100644 Koha/Exception/BadSystemPreference.pm create mode 100644 Koha/Exception/ConnectionFailed.pm create mode 100644 Koha/Exception/DuplicateObject.pm create mode 100644 Koha/Exception/FeatureUnavailable.pm create mode 100644 Koha/Exception/File.pm create mode 100644 Koha/Exception/LoginFailed.pm create mode 100644 Koha/Exception/Logout.pm create mode 100644 Koha/Exception/NoPermission.pm create mode 100644 Koha/Exception/NoSystemPreference.pm create mode 100644 Koha/Exception/RemoteInvocation.pm create mode 100644 Koha/Exception/ServiceTemporarilyUnavailable.pm create mode 100644 Koha/Exception/SystemCall.pm create mode 100644 Koha/Exception/UnknownObject.pm create mode 100644 Koha/Exception/UnknownProgramState.pm create mode 100644 Koha/Exception/UnknownProtocol.pm create mode 100644 Koha/Exception/VersionMismatch.pm diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index 9ddeca8..ccb777a 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -99,6 +99,11 @@ our $PERL_DEPS = { 'required' => '1', 'min_ver' => '1.103' }, + 'Exception::Class' => { + 'usage' => 'Core', + 'required' => '1.39', + 'min_ver' => '1.39' + }, 'HTML::Scrubber' => { 'usage' => 'Core', 'required' => '1', diff --git a/Koha/Exception/BadAuthenticationToken.pm b/Koha/Exception/BadAuthenticationToken.pm new file mode 100644 index 0000000..4c63d19 --- /dev/null +++ b/Koha/Exception/BadAuthenticationToken.pm @@ -0,0 +1,28 @@ +package Koha::Exception::BadAuthenticationToken; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::BadAuthenticationToken' => { + description => 'Authentication token is invalid', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/BadEncoding.pm b/Koha/Exception/BadEncoding.pm new file mode 100644 index 0000000..e26142f --- /dev/null +++ b/Koha/Exception/BadEncoding.pm @@ -0,0 +1,28 @@ +package Koha::Exception::BadEncoding; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::BadEncoding' => { + description => 'Something wrong with the character encoding', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/BadParameter.pm b/Koha/Exception/BadParameter.pm new file mode 100644 index 0000000..1c56cf6 --- /dev/null +++ b/Koha/Exception/BadParameter.pm @@ -0,0 +1,28 @@ +package Koha::Exception::BadParameter; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::BadParameter' => { + description => 'Something wrong with the given parameters', + }, +); + +return 1; diff --git a/Koha/Exception/BadSystemPreference.pm b/Koha/Exception/BadSystemPreference.pm new file mode 100644 index 0000000..6d24039 --- /dev/null +++ b/Koha/Exception/BadSystemPreference.pm @@ -0,0 +1,29 @@ +package Koha::Exception::BadSystemPreference; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::BadSystemPreference' => { + description => 'System preference value is incomprehensible', + fields => ['syspref'], + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/ConnectionFailed.pm b/Koha/Exception/ConnectionFailed.pm new file mode 100644 index 0000000..1c35949 --- /dev/null +++ b/Koha/Exception/ConnectionFailed.pm @@ -0,0 +1,28 @@ +package Koha::Exception::ConnectionFailed; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::ConnectionFailed' => { + description => 'Connecting to host failed', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/DuplicateObject.pm b/Koha/Exception/DuplicateObject.pm new file mode 100644 index 0000000..d796cbe --- /dev/null +++ b/Koha/Exception/DuplicateObject.pm @@ -0,0 +1,28 @@ +package Koha::Exception::DuplicateObject; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::DuplicateObject' => { + description => 'Same object already exists', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/FeatureUnavailable.pm b/Koha/Exception/FeatureUnavailable.pm new file mode 100644 index 0000000..f4149c2 --- /dev/null +++ b/Koha/Exception/FeatureUnavailable.pm @@ -0,0 +1,28 @@ +package Koha::Exception::FeatureUnavailable; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::FeatureUnavailable' => { + description => 'Feature requested is not currently available', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/File.pm b/Koha/Exception/File.pm new file mode 100644 index 0000000..aa4cb98 --- /dev/null +++ b/Koha/Exception/File.pm @@ -0,0 +1,28 @@ +package Koha::Exception::File; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::File' => { + description => 'Something wrong with the given file', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/LoginFailed.pm b/Koha/Exception/LoginFailed.pm new file mode 100644 index 0000000..561d5c3 --- /dev/null +++ b/Koha/Exception/LoginFailed.pm @@ -0,0 +1,28 @@ +package Koha::Exception::LoginFailed; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::LoginFailed' => { + description => 'Login to host failed', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/Logout.pm b/Koha/Exception/Logout.pm new file mode 100644 index 0000000..3a60bde --- /dev/null +++ b/Koha/Exception/Logout.pm @@ -0,0 +1,28 @@ +package Koha::Exception::Logout; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::Logout' => { + description => 'User logged out, catch this and redirect.', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/NoPermission.pm b/Koha/Exception/NoPermission.pm new file mode 100644 index 0000000..774311a --- /dev/null +++ b/Koha/Exception/NoPermission.pm @@ -0,0 +1,28 @@ +package Koha::Exception::NoPermission; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::NoPermission' => { + description => 'User has no permission to do whatever he was up to', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/NoSystemPreference.pm b/Koha/Exception/NoSystemPreference.pm new file mode 100644 index 0000000..ad6f0b8 --- /dev/null +++ b/Koha/Exception/NoSystemPreference.pm @@ -0,0 +1,29 @@ +package Koha::Exception::NoSystemPreference; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::NoSystemPreference' => { + description => 'Required system preference is not set', + fields => ['syspref'], + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/RemoteInvocation.pm b/Koha/Exception/RemoteInvocation.pm new file mode 100644 index 0000000..bca3c0b --- /dev/null +++ b/Koha/Exception/RemoteInvocation.pm @@ -0,0 +1,28 @@ +package Koha::Exception::RemoteInvocation; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::RemoteInvocation' => { + description => 'Interacting with a remote process failed', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/ServiceTemporarilyUnavailable.pm b/Koha/Exception/ServiceTemporarilyUnavailable.pm new file mode 100644 index 0000000..2747726 --- /dev/null +++ b/Koha/Exception/ServiceTemporarilyUnavailable.pm @@ -0,0 +1,28 @@ +package Koha::Exception::ServiceTemporarilyUnavailable; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::ServiceTemporarilyUnavailable' => { + description => 'Service is temporarily unavailable', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/SystemCall.pm b/Koha/Exception/SystemCall.pm new file mode 100644 index 0000000..35dfe18 --- /dev/null +++ b/Koha/Exception/SystemCall.pm @@ -0,0 +1,28 @@ +package Koha::Exception::SystemCall; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::SystemCall' => { + description => 'Making a system call failed', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/UnknownObject.pm b/Koha/Exception/UnknownObject.pm new file mode 100644 index 0000000..2647f5a --- /dev/null +++ b/Koha/Exception/UnknownObject.pm @@ -0,0 +1,28 @@ +package Koha::Exception::UnknownObject; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::UnknownObject' => { + description => 'Object cannot be found or is not known', + }, +); + +return 1; diff --git a/Koha/Exception/UnknownProgramState.pm b/Koha/Exception/UnknownProgramState.pm new file mode 100644 index 0000000..0f5b6c9 --- /dev/null +++ b/Koha/Exception/UnknownProgramState.pm @@ -0,0 +1,28 @@ +package Koha::Exception::UnknownProgramState; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::UnknownProgramState' => { + description => 'The running program has done something terribly unpredicatable', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/UnknownProtocol.pm b/Koha/Exception/UnknownProtocol.pm new file mode 100644 index 0000000..0365f2e --- /dev/null +++ b/Koha/Exception/UnknownProtocol.pm @@ -0,0 +1,28 @@ +package Koha::Exception::UnknownProtocol; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::UnknownProtocol' => { + description => 'Protocol is not known', + }, +); + +return 1; \ No newline at end of file diff --git a/Koha/Exception/VersionMismatch.pm b/Koha/Exception/VersionMismatch.pm new file mode 100644 index 0000000..3e57155 --- /dev/null +++ b/Koha/Exception/VersionMismatch.pm @@ -0,0 +1,28 @@ +package Koha::Exception::VersionMismatch; + +# Copyright 2015 Vaara-kirjastot +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; + +use Exception::Class ( + 'Koha::Exception::VersionMismatch' => { + description => 'Versions do not match', + }, +); + +return 1; \ No newline at end of file -- 1.9.1