catch
Script
v5
Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
* This script helps you debug vals - it catches JavaScript errors
* and sends them up to the application so Townie can help fix them.
*/
window
.
addEventListener
(
"error"
,
e
=>
{
window
.
top
.
postMessage
(
{
type
:
"error"
,
message
:
e
.
message
,
}
,
"*"
)
;
}
)
;
window
.
addEventListener
(
"unhandledrejection"
,
e
=>
{
window
.
top
.
postMessage
(
{
type
:
"error"
,
message
:
String
(
e
.
reason
)
,
}
,
"*"
)
;
}
)
;