diff --git a/src/js/auth.js b/src/js/auth.js
index b994663..68e8266 100644
--- a/src/js/auth.js
+++ b/src/js/auth.js
@@ -44,7 +44,7 @@ page.onAxiosError = error => {
const statusText = cloudflareErrors[error.response.status] || error.response.statusText
const description = error.response.data && error.response.data.description
? error.response.data.description
- : 'There was an error with the request, please check the console for more information.'
+ : 'There was an error with the request.\nPlease check the console for more information.'
return swal(`${error.response.status} ${statusText}`, description, 'error')
}
diff --git a/src/js/dashboard.js b/src/js/dashboard.js
index 91e4212..d714256 100644
--- a/src/js/dashboard.js
+++ b/src/js/dashboard.js
@@ -112,7 +112,10 @@ page.onError = error => {
console.error(error)
const content = document.createElement('div')
- content.innerHTML = `${error.toString()}
`
+ content.innerHTML = `
+
${error.toString()}
Please check your console for more information.
+ ` return swal({ title: 'An error occurred!', icon: 'error', @@ -140,7 +143,7 @@ page.onAxiosError = error => { const statusText = cloudflareErrors[error.response.status] || error.response.statusText const description = error.response.data && error.response.data.description ? error.response.data.description - : 'There was an error with the request, please check the console for more information.' + : 'There was an error with the request.\nPlease check the console for more information.' return swal(`${error.response.status} ${statusText}`, description, 'error') } diff --git a/src/js/home.js b/src/js/home.js index cbf0d61..ae94373 100644 --- a/src/js/home.js +++ b/src/js/home.js @@ -90,7 +90,10 @@ page.onError = error => { console.error(error) const content = document.createElement('div') - content.innerHTML = `${error.toString()}
`
+ content.innerHTML = `
+ ${error.toString()}
Please check your console for more information.
+ ` return swal({ title: 'An error occurred!', icon: 'error', @@ -120,7 +123,7 @@ page.onAxiosError = (error, cont) => { if (!cont) { const description = error.response.data && error.response.data.description ? error.response.data.description - : 'There was an error with the request, please check the console for more information.' + : 'There was an error with the request.\nPlease check the console for more information.' return swal(`${error.response.status} ${statusText}`, description, 'error') } else if (error.response.data && error.response.data.description) { return error.response diff --git a/src/js/player.js b/src/js/player.js index 81187e6..b245d58 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -21,6 +21,22 @@ const page = { // Disable video.js telemetry (should already be disabled by default since v7 though) window.HELP_IMPROVE_VIDEOJS = false +// Handler for regular JS errors +page.onError = error => { + console.error(error) + + const content = document.createElement('div') + content.innerHTML = ` +${error.toString()}
Please check your console for more information.
+ ` + return swal({ + title: 'An error occurred!', + icon: 'error', + content + }) +} + // Handler for Axios errors page.onAxiosError = error => { // Better Cloudflare errors @@ -125,7 +141,8 @@ page.reloadVideo = () => { page.toggleReloadBtn(true) }).catch(error => { page.toggleReloadBtn(true) - page.onAxiosError(error) + if (typeof error.response !== 'undefined') page.onAxiosError(error) + else page.onError(error) }) }