Moved try/catch block around existing localStorage call to remove the need for extra test calls