fetchuser error handling

This commit is contained in:
zeppi 2021-09-21 15:09:14 -04:00
parent 22906b5857
commit c9ced4f226
3 changed files with 25 additions and 6 deletions

12
dist/bundle.es.js vendored
View file

@ -333,7 +333,11 @@ Lbryio.deleteAuthToken = () => new Promise(resolve => {
});
});
Lbryio.fetchCurrentUser = () => Lbryio.call('user', 'me');
Lbryio.fetchCurrentUser = () => Lbryio.call('user', 'me').catch(e => ({
error: {
message: e.message
}
}));
Lbryio.fetchUser = async (domain, language) => {
if (!Lbryio.fetchingUser) {
@ -376,7 +380,11 @@ Lbryio.fetchNewUser = async (domain, language) => {
return userResponse;
} catch (e) {
console.log('error', e.message);
return false;
return {
error: {
message: e.message
}
};
}
};

14
dist/bundle.js vendored
View file

@ -649,7 +649,13 @@ Lbryio.deleteAuthToken = function () {
};
Lbryio.fetchCurrentUser = function () {
return Lbryio.call('user', 'me');
return Lbryio.call('user', 'me')["catch"](function (e) {
return {
error: {
message: e.message
}
};
});
};
Lbryio.fetchUser =
@ -771,7 +777,11 @@ function () {
_context2.prev = 17;
_context2.t0 = _context2["catch"](0);
console.log('error', _context2.t0.message);
return _context2.abrupt("return", false);
return _context2.abrupt("return", {
error: {
message: _context2.t0.message
}
});
case 21:
case "end":

View file

@ -127,7 +127,8 @@ Lbryio.deleteAuthToken = () =>
});
});
Lbryio.fetchCurrentUser = () => Lbryio.call('user', 'me');
Lbryio.fetchCurrentUser = () =>
Lbryio.call('user', 'me').catch(e => ({ error: { message: e.message } }));
Lbryio.fetchUser = async (domain, language) => {
if (!Lbryio.fetchingUser) {
@ -173,7 +174,7 @@ Lbryio.fetchNewUser = async (domain, language) => {
return userResponse;
} catch (e) {
console.log('error', e.message);
return false;
return { error: { message: e.message } };
}
};