I had an error when I used Ionic3's native-storage. It couldn't read the data in native-storage correctly. The error code: 2, but there was no detailed description.
public async getToken(): Promise<AccessToken> {
let token = null;
let expires = null;
try{
token = await this.storage.getItem(this.ACCESSTOKEN_KEY);
expires = await this.storage.getItem(this.ACCESSTOKEN_EXPIRES_KEY);
}catch(e){
alert(JSON.stringify(e));
}
if (token == null || expires == null || expires < new Date()) {
token = null;
}
return token;
}
Error screenshot:

Error codes contains an integer which specifies the occurred error:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With