try-catch saving into localStorage