mirror of https://github.com/gophish/gophish
Added error handling to in-app reporting mechanism
parent
ac9e6a7190
commit
8e79294413
File diff suppressed because one or more lines are too long
|
@ -936,12 +936,24 @@ function report_mail(rid, cid) {
|
||||||
report_url = new URL(c.url)
|
report_url = new URL(c.url)
|
||||||
report_url.pathname = '/report'
|
report_url.pathname = '/report'
|
||||||
report_url.search = "?rid=" + rid
|
report_url.search = "?rid=" + rid
|
||||||
$.ajax({
|
fetch(report_url)
|
||||||
url: report_url,
|
.then(response => {
|
||||||
method: "GET",
|
if (!response.ok) {
|
||||||
success: function(data) {
|
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
refresh();
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
let errorMessage = error.message;
|
||||||
|
if (error.message === "Failed to fetch") {
|
||||||
|
errorMessage = "This might be due to Mixed Content issues or network problems.";
|
||||||
|
}
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Error',
|
||||||
|
text: errorMessage,
|
||||||
|
type: 'error',
|
||||||
|
confirmButtonText: 'Close'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue