UNPKG

@frontierjs/web

Version:

Web modules for FrontierJS

22 lines (21 loc) 523 B
// src/errors.js function Errors(spec = {}) { const { errorsUrl } = spec; return () => { window.addEventListener("unhandledrejection", async function handleUnhandled(event) { if (!errorsUrl) return console.error(event.reason); await fetch(errorsUrl, { method: "POST", body: JSON.stringify({ error: String(event.reason) }), mode: "no-cors", headers: { "Content-Type": "application/json" } }); }); }; } export { Errors as default };