projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
93e82ba
)
Lieferschein TypeData: croak wenn typ nicht existiert
author
Sven Schöling
<s.schoeling@googlemail.com>
Sun, 5 Dec 2021 19:45:20 +0000
(20:45 +0100)
committer
Jan Büren
<jan@kivitendo.de>
Mon, 14 Feb 2022 14:02:19 +0000
(15:02 +0100)
SL/DB/DeliveryOrder/TypeData.pm
patch
|
blob
|
history
diff --git
a/SL/DB/DeliveryOrder/TypeData.pm
b/SL/DB/DeliveryOrder/TypeData.pm
index
7cde08e
..
c65e7ff
100644
(file)
--- 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) = @_;
sub validate_type {
my ($type) = @_;
- return $valid_types{$type} // c
onfess
"invalid type '$type'";
+ return $valid_types{$type} // c
roak
"invalid type '$type'";
}
sub get {
my ($type, $key) = @_;
}
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'
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) = @_;
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->()
ref $ret eq 'CODE'
? $ret->()