Fix error handling in fetching publicKey

This commit is contained in:
Neeraj Gupta 2023-01-31 13:15:34 +05:30
parent 041432461f
commit db2df1665a
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1

View file

@ -117,6 +117,8 @@ class UserService {
}
}
// getPublicKey returns null value if email id is not
// associated with another ente account
Future<String?> getPublicKey(String email) async {
try {
final response = await _enteDio.get(
@ -127,8 +129,10 @@ class UserService {
await PublicKeysDB.instance.setKey(PublicKey(email, publicKey));
return publicKey;
} on DioError catch (e) {
_logger.info(e);
return null;
if (e.response != null && e.response?.statusCode == 404) {
return null;
}
rethrow;
}
}