I am saving several items to localStorage using ngStorage in AngularJS, but if the user's localStorage is full how can I catch that error and allow the JavaScript to keep running?
try {  
    $scope.$storage.gridObject = $scope.gridConfig.data;  
    $scope.$storage.dataStored=true; 
}  
catch(err) {  
    //failed to save to local storage,  try clearing localStorage for IAP and throw error  
    $scope.$storage.dataStored=false;  
    $scope.$storage.$reset({    
        dataStored: false,
        gridObject: {}  
    })  
    console.log('error occured message');  
}
 
     
    