fix(api): properly handle errors in crawler loop

This commit is contained in:
Julian Tölle 2023-03-17 17:37:08 +01:00
parent 471f46eb8d
commit 0e2c56bf5f

View file

@ -99,17 +99,16 @@ export class SpotifyService {
{ userId: user.id },
`Refreshing access token failed for user "${user.id}": ${errFromAuth}`
);
throw errFromAuth;
}
} else {
// TODO sent to sentry
this.logger.error(
`Unexpected error while fetching recently played tracks: ${err}`
);
return;
}
// Makes no sense to keep processing the (inexistent) data but if we throw
// the error the fetch loop will not process other users.
return;
this.logger.error(
`Unexpected error while fetching recently played tracks: ${err}`
);
throw err;
}
if (playHistory.length === 0) {