Does amplify.store return error or catch exception when local storage limit exceeded?
Asked Answered
T

1

6

Is there e way to check if local storage limit is exceeded after a call like this:

amplify.store("key", object);

What happens if i try to store something bigger than the local storage limit ?

Thorp answered 20/9, 2012 at 7:55 Comment(0)
G
11

yes , it throws "amplify.store quota exceeded" , as you can see here

store.error = function() {
    return "amplify.store quota exceeded"; 
};

...

try {
                    storage.setItem( key, parsed );
                // quota exceeded
                } catch( error ) {
                    // expire old data and try again
                    store[ storageType ]();
                    try {
                        storage.setItem( key, parsed );
                    } catch( error ) {
                        throw store.error();
                    }
                }
Gilded answered 9/11, 2012 at 10:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.