From d4b73046b92dd7ba05bc7aa207fa283eb7586316 Mon Sep 17 00:00:00 2001 From: topkek Date: Sun, 28 Sep 2014 20:00:43 +0100 Subject: [PATCH] Error/404 handling --- js/auto-reload.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/js/auto-reload.js b/js/auto-reload.js index de4326a4..7803a492 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -179,6 +179,21 @@ $(document).ready(function(){ else $('#update_secs').text("No new posts found"); } + }, + error: function(xhr, status_text, error_text) { + if (status_text == "error") { + if (error_text == "Not Found") { + $('#update_secs').text("Thread deleted or pruned"); + $('#auto_update_status').prop('checked', false); + $('#auto_update_status').prop('disabled', true); // disable updates if thread is deleted + } else { + $('#update_secs').text("Error: "+error_text); + } + } else if (status_text) { + $('#update_secs').text("Error: "+status_text); + } else { + $('#update_secs').text("Unknown error"); + } } });