Skip to content

Commit

Permalink
[bug-fix] don't crash on not being able to query the SQS queue when r…
Browse files Browse the repository at this point in the history
…unning locally
  • Loading branch information
lourot committed Oct 10, 2018
1 parent 658a824 commit f4deed7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions reframe/views/profile/rightpanel/contrib/getContribInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ async function getAllData({username}) {
const {user, contribs, profileDoesNotExist} = await getUserData({username});

if( profileDoesNotExist ) {
// This profile doesn't exist yet, let's see if it's being created:
const pendingProfilesInfo = await getPendingProfilesInfo({username, user});
assert_internal(pendingProfilesInfo.user && pendingProfilesInfo.profilesBeingCreated);
return {...pendingProfilesInfo, profileDoesNotExist};
Expand Down Expand Up @@ -153,10 +154,12 @@ async function getAllRepoData(contribs) {

async function getPendingProfilesInfo({username, user={}}) {
const userId = getUserId({username});
// This profile doesn't exist yet, let's see if it's being created:
const {profileQueueUrl} = urls;
const profilesBeingCreatedData = await fetch(profileQueueUrl);
const profilesBeingCreated = await profilesBeingCreatedData.json();
let profilesBeingCreated = [];
try {
const profilesBeingCreatedData = await fetch(profileQueueUrl);
profilesBeingCreated = await profilesBeingCreatedData.json();
} catch (_) {} // when running locally no 'Access-Control-Allow-Origin' header is present
assert_internal(profilesBeingCreated, {profileQueueUrl, profilesBeingCreated});
user.login = user.login || username;
for (const profile of profilesBeingCreated) {
Expand Down

0 comments on commit f4deed7

Please sign in to comment.