X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FX.pm;h=e1707cd0e3bfef0ff5b4137f892246e2a71e3047;hb=2a0cbd885790174fa0f212e6661b30362650a42c;hp=552e5ef29a0e3976f4f58a6dc5227d2a0cd51469;hpb=0281b86dc6c14910b263e7771673599544973616;p=kivitendo-erp.git diff --git a/SL/X.pm b/SL/X.pm index 552e5ef29..e1707cd0e 100644 --- a/SL/X.pm +++ b/SL/X.pm @@ -1,10 +1,48 @@ package SL::X; use strict; +use warnings; -use Exception::Lite qw(declareExceptionClass); +use SL::X::Base; -declareExceptionClass('SL::X::FormError'); -declareExceptionClass('SL::X::DBHookError', [ '%s hook \'%s\' for object type \'%s\' failed', qw(when hook object_type object) ]); + +# note! the default fields "message", "error" and "show_trace" are created by +# Exception::Class if message or error are given, they are used for +# stringification, so don't use them in error_templates +# +use Exception::Class ( + 'SL::X::FormError' => { + isa => 'SL::X::Base', + }, + 'SL::X::DBError' => { + isa => 'SL::X::Base', + fields => [ qw(msg db_error) ], + defaults => { error_template => [ '%s: %s', qw(msg db_error) ] }, + }, + 'SL::X::DBHookError' => { + isa => 'SL::X::DBError', + fields => [ qw(when hook object object_type) ], + defaults => { error_template => [ '%s hook \'%s\' for object type \'%s\' failed', qw(when hook object_type object) ] }, + }, + 'SL::X::DBRoseError' => { + isa => 'SL::X::DBError', + fields => [ qw(class metaobject object) ], + defaults => { error_template => [ '\'%s\' in object of type \'%s\' occurred', qw(db_error class) ] }, + }, + 'SL::X::DBUtilsError' => { + isa => 'SL::X::DBError', + }, + 'SL::X::ZUGFeRDValidation' => { + isa => 'SL::X::Base', + }, + 'SL::X::Inventory' => { + isa => 'SL::X::Base', + fields => [ qw(code) ], + }, + 'SL::X::Inventory::Allocation' => { + isa => 'SL::X::Base', + fields => [ qw(code) ], + }, +); 1;