Skip to content

Commit

Permalink
better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pradipmudi committed May 21, 2024
1 parent 31605c6 commit a5d1eb6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/resources/static/js/expenseByMonth.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,15 @@ function fetchExpenseData() {

if (data.length > 0) {
updateCurrentPageElement();
} else {
}
if(data.length < 10 || data.length == 0) {
nextPageButtonTop.disabled = true;
nextPageButtonBottom.disabled = true;
if(data.length == 0){
console.error('Error fetching data:', error);
errorMessage.innerHTML = `No data available or there was some error fetching data. Please try again.<br>Error: ${error.message}`;
errorMessage.style.display = 'block';
}
}
})
.catch(error => {
Expand Down

0 comments on commit a5d1eb6

Please sign in to comment.