Skip to content

Commit 491e640

Browse files
committed
check for compilation errors in document set modules
ElasticSearchX::Model ignores all errors in a ::Set package can't be loaded, and uses a generic ElasticSearchX::Model::Document::Set object. It's fine for the module to be missing, but compilation errors should be reported.
1 parent 94c84ea commit 491e640

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/MetaCPAN/Model.pm

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use Moose;
55

66
use ElasticSearchX::Model;
77
use MetaCPAN::ESConfig qw(es_config);
8-
use Module::Runtime qw(require_module);
8+
use Module::Runtime qw(require_module use_package_optimistically);
99

1010
my %indexes;
1111
my $docs = es_config->documents;
@@ -14,6 +14,7 @@ for my $name ( sort keys %$docs ) {
1414
my $model = $doc->{model}
1515
or next;
1616
require_module($model);
17+
use_package_optimistically( $model . '::Set' );
1718
my $index = $doc->{index}
1819
or die "no index for $name documents!";
1920

0 commit comments

Comments
 (0)