-
Notifications
You must be signed in to change notification settings - Fork 41
/
errors.html
38 lines (38 loc) · 1.18 KB
/
errors.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<title>Error generator</title>
</head>
<h1>Error-generating test page</h1>
<a href="?exception">Generate unhandled exception</a><br>
<a href="?error">Generate console error</a><br>
<a href="?warn">Generate console warning</a><br>
<a href="?log">Genereate console log</a><br>
<hr>
Output:<br>
<pre id="output"></pre>
<script type="application/javascript">
function log(str) {
document.getElementById("output").textContent += str + "\n";
}
switch(window.location.search)
{
case "?exception":
log("Throwing exception");
throw new Error("my exception");
break;
case "?error":
console.error("Console error");
log("Generated console error");
break;
case "?warn":
console.warn("Console warning");
log("Generated console warning");
break;
case "?log":
console.log("Console log");
log("Generating console log");
break;
}
</script>
</html>