catch some js network errors
This commit is contained in:
parent
e08667ab8a
commit
9182157597
1 changed files with 4 additions and 2 deletions
|
@ -56,8 +56,9 @@ const NUMBER_PER_REQUEST = 20
|
|||
// ]
|
||||
async function getFollowers(id, mastodonURI, token, callback) {
|
||||
const url = mastodonURI + API_FOLLOWERS.replace(":id", id);
|
||||
var response;
|
||||
try {
|
||||
const response = await fetch(url+'?limit='+NUMBER_PER_REQUEST, {headers: {'Authorization': 'Bearer ' + token}});
|
||||
response = await fetch(url+'?limit='+NUMBER_PER_REQUEST, {headers: {'Authorization': 'Bearer ' + token}});
|
||||
} catch (e) {
|
||||
console.error('loading followers failed.');
|
||||
return;
|
||||
|
@ -78,8 +79,9 @@ async function getFollowers(id, mastodonURI, token, callback) {
|
|||
|
||||
async function getFollowing(id, mastodonURI, token, callback) {
|
||||
const url = mastodonURI + API_FOLLOWING.replace(":id", id);
|
||||
var response;
|
||||
try {
|
||||
const response = await fetch(url+'?limit='+NUMBER_PER_REQUEST, {headers: {'Authorization': 'Bearer ' + token}});
|
||||
response = await fetch(url+'?limit='+NUMBER_PER_REQUEST, {headers: {'Authorization': 'Bearer ' + token}});
|
||||
} catch (e) {
|
||||
console.error('loading following failed.');
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue