@@ -2,4 +2,28 @@ document.getElementById("contactForm")?.addEventListener("submit", function(e) {
2
2
e . preventDefault ( ) ;
3
3
alert ( "Message sent! We'll get back to you soon." ) ;
4
4
} ) ;
5
-
5
+
6
+ window . onerror = function ( message , source , lineno , colno , error ) {
7
+ console . log ( "Error occurred: " , message ) ;
8
+ // Redirecting based on error
9
+ if ( message . includes ( "404" ) ) {
10
+ window . location . href = "404.html" ;
11
+ } else if ( message . includes ( "505" ) ) {
12
+ window . location . href = "505.html" ;
13
+ } else if ( message . includes ( "1010" ) ) {
14
+ window . location . href = "1010.html" ;
15
+ } else if ( message . includes ( "303" ) ) {
16
+ window . location . href = "303.html" ;
17
+ } else if ( message . includes ( "606" ) ) {
18
+ window . location . href = "606.html" ;
19
+ } else if ( message . includes ( "707" ) ) {
20
+ window . location . href = "707.html" ;
21
+ } else if ( message . includes ( "808" ) ) {
22
+ window . location . href = "808.html" ;
23
+ } else if ( message . includes ( "909" ) ) {
24
+ window . location . href = "909.html" ;
25
+ } else if ( message . includes ( "202" ) ) {
26
+ window . location . href = "202.html" ;
27
+ }
28
+ return true ; // Prevents the default browser error page
29
+ } ;
0 commit comments