Skip to content

Commit

Permalink
Catch network errors that result from a keyset URL not working properly.
Browse files Browse the repository at this point in the history
This should fix openwebwork#2663.
  • Loading branch information
drgrice1 committed Feb 18, 2025
1 parent ab56984 commit 55b342b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/WeBWorK/ContentGenerator/LTIAdvantage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,11 @@ sub get_lms_public_keyset ($c, $ce, $db, $renew = 0) {
}

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

0 comments on commit 55b342b

Please sign in to comment.