File: index.js

package info (click to toggle)
node-tad 3.1.1%2B~cs11.22.49-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,400 kB
  • sloc: javascript: 25,549; makefile: 6
file content (30 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (2)
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
"use strict";

var uniGlobal = require("uni-global")("medikoo/essentials/202112");

if (uniGlobal.isSetup) {
	// Doubled load of essentials, abort
	return;
}

uniGlobal.isSetup = true;

// 1. Expose every stack frame in error stack trace
Error.stackTraceLimit = Infinity;

// 2. Expose unhandled promise rejections as uncaught exceptions
if (typeof process === "object" && process && typeof process.on === "function") {
	// Node.js
	process.on("unhandledRejection", function (reason) {
		// If user attached its own unhandledRejection handler, abort
		if (process.listenerCount("unhandledRejection") > 1) return;
		throw reason;
	});
}
if (typeof addEventListener === "function") {
	// HTML
	addEventListener("unhandledrejection", function (event) {
		event.preventDefault();
		throw event.reason;
	});
}