From 405b577b5b7b3e82c20e0708f67f727c256814e0 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 15 Nov 2024 16:25:19 +0100 Subject: [PATCH] Bug 38136: Die early if the localization relationship does not exist confess shows the whole stacktrace which is useful to spot where we made a mistake (croak showed the wrong file) --- Koha/Schema/Component/Localization.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Koha/Schema/Component/Localization.pm b/Koha/Schema/Component/Localization.pm index bd93f893b1..9c485efa2a 100644 --- a/Koha/Schema/Component/Localization.pm +++ b/Koha/Schema/Component/Localization.pm @@ -94,6 +94,7 @@ queries =cut use Modern::Perl; +use Carp; use base qw(DBIx::Class); @@ -101,6 +102,9 @@ sub localization_add_relationships { my ($class, $rel_name, $fk_column, $pk_column, @properties) = @_; my $rel_info = $class->relationship_info($rel_name); + unless ($rel_info) { + confess "Unknown relation '$rel_name'"; + } $class->has_many( 'localizations', -- 2.39.2