From: Sven Schöling Date: Sun, 5 Dec 2021 19:45:20 +0000 (+0100) Subject: Lieferschein TypeData: croak wenn typ nicht existiert X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~216^2~45 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3e264463781b8d08f6e81aafd57f18c6d9550c92;p=kivitendo-erp.git Lieferschein TypeData: croak wenn typ nicht existiert --- diff --git a/SL/DB/DeliveryOrder/TypeData.pm b/SL/DB/DeliveryOrder/TypeData.pm index 7cde08ede..c65e7ffe4 100644 --- a/SL/DB/DeliveryOrder/TypeData.pm +++ b/SL/DB/DeliveryOrder/TypeData.pm @@ -154,12 +154,14 @@ sub is_valid_type { sub validate_type { my ($type) = @_; - return $valid_types{$type} // confess "invalid type '$type'"; + return $valid_types{$type} // croak "invalid type '$type'"; } sub get { my ($type, $key) = @_; + croak "invalid type '$type'" unless exists $type_data{$type}; + my $ret = $type_data{$type}->{$key} // die "unknown property '$key'"; ref $ret eq 'CODE' @@ -170,7 +172,9 @@ sub get { sub get3 { my ($type, $topic, $key) = @_; - my $ret = $type_data{$type}{$topic}{$key} // die "unknown property '$key' in topic '$topic' for type '$type'"; + croak "invalid type '$type'" unless exists $type_data{$type}; + + my $ret = $type_data{$type}{$topic}{$key} // croak "unknown property '$key' in topic '$topic' for type '$type'"; ref $ret eq 'CODE' ? $ret->()