Public
Script
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme

Catch

This val is a helper for Townie, which sends client-side errors up to the top frame so that Townie can assist you in fixing them.

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),
}, "*");
});
September 16, 2024