Skip to content

Commit 55b342b

Browse files
committed
Catch network errors that result from a keyset URL not working properly.
This should fix openwebwork#2663.
1 parent ab56984 commit 55b342b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/WeBWorK/ContentGenerator/LTIAdvantage.pm

+5-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,11 @@ sub get_lms_public_keyset ($c, $ce, $db, $renew = 0) {
323323
}
324324

325325
# Get public keyset from the LMS.
326-
my $response = Mojo::UserAgent->new->get($ce->{LTI}{v1p3}{PublicKeysetURL})->result;
326+
my $response = eval { Mojo::UserAgent->new->get($ce->{LTI}{v1p3}{PublicKeysetURL})->result };
327+
if ($@) {
328+
$c->stash->{LTIAuthenError} = "Failed to obtain public key from LMS due to a network error: $@";
329+
return;
330+
}
327331
unless ($response->is_success) {
328332
$c->stash->{LTIAuthenError} = 'Failed to obtain public key from LMS: ' . $response->message;
329333
return;

0 commit comments

Comments
 (0)