{"ScriptPreparationCode":null,"TestCases":[{"Name":"old","Code":"const Utils = class Self {\r\n static deepStringify (origData) {\r\n const getIsInstanceOfObject = function (val) {\r\n return typeof val === \u0027object\u0027 \u0026\u0026 val !== null\r\n }\r\n\r\n const parseForStringify = function (data) {\r\n if (Array.isArray(data)) {\r\n return data.map(el =\u003E getIsInstanceOfObject(el) ?\r\n parseForStringify(el) :\r\n el\r\n )\r\n }\r\n\r\n if (getIsInstanceOfObject(data)) {\r\n return Object.getOwnPropertyNames(data)\r\n .reduce((acc, key) =\u003E Object.assign({}, acc, {\r\n [key]: getIsInstanceOfObject(data[key]) ?\r\n parseForStringify(data[key]) :\r\n data[key]\r\n }), {})\r\n }\r\n\r\n return data\r\n }\r\n\r\n return JSON.stringify(parseForStringify(origData))\r\n }\r\n\r\n static logError(/*{ args, msg, err }*/) {\r\n const params = arguments[0] === Object(arguments[0]) ?\r\n arguments[0] :\r\n {}\r\n const args = Array.isArray(params.args) ?\r\n params.args :\r\n []\r\n const msg = typeof params.msg === \u0027string\u0027 ?\r\n params.msg :\r\n \u0027Internal error when processing some data\u0027\r\n const err = params.err instanceof Error ?\r\n params.err :\r\n new Error(\u0027Unknown error\u0027)\r\n\r\n const stringifiedArgs = Self.deepStringify(args)\r\n\r\n //log in development\r\n console.log()\r\n console.error(\u0060 Function arguments:${stringifiedArgs}\\n\u0060, err)\r\n console.log()\r\n\r\n // for the logging service\r\n const commonProps = {\r\n arguments: JSON.parse(stringifiedArgs),\r\n date: new Date().toUTCString(),\r\n error: err\r\n }\r\n\r\n if (Self.isBrowser) {\r\n //TODO notify the user\r\n alert(msg)\r\n\r\n //logging service in production\r\n console.info(Self.deepStringify({\r\n ...commonProps,\r\n localUrl: window.location.href,\r\n machineInfo: {\r\n browserInfo: window.navigator.userAgent,\r\n language: window.navigator.language,\r\n osType: window.navigator.platform\r\n }\r\n }))\r\n }\r\n\r\n if (Self.isNodeJS) {\r\n //logging service in production\r\n console.info(Self.deepStringify({\r\n ...commonProps,\r\n localUrl: __filename,\r\n machineInfo: {\r\n cpuArch: process.arch,\r\n osType: process.platform,\r\n depVersions: process.versions\r\n }\r\n }))\r\n }\r\n }\r\n\r\n static catchFunc({ msg, defaultVal, innerFunc } = {}) {\r\n if (typeof innerFunc !== \u0027function\u0027) {\r\n Self.logError({\r\n err: new Error(\u0060Was not given a function - ${innerFunc}\u0060)\r\n })\r\n\r\n return defaultVal\r\n }\r\n\r\n if (innerFunc instanceof (async () =\u003E {}).constructor) {\r\n return async function(...args) {\r\n try {\r\n return await innerFunc.apply(this, args)\r\n } catch(err) {\r\n Self.logError({ err, args, msg })\r\n\r\n return defaultVal\r\n }\r\n }\r\n }\r\n\r\n return function(...args) {\r\n try {\r\n return innerFunc.apply(this, args)\r\n } catch(err) {\r\n Self.logError({ err, args, msg })\r\n\r\n return defaultVal\r\n }\r\n }\r\n }\r\n\r\n static createObject({ classesToInherit, classProps, instanceProps } = {}) {\r\n Self.finalizeClass.call(this.constructor, { classesToInherit, classProps })\r\n Self.bindProps.call(this, { classesToInherit, instanceProps })\r\n }\r\n\r\n static bindProps({ classesToInherit = [], instanceProps = {} } = {}) {\r\n if (!Object.isFrozen(this)) {\r\n //get the props from the inherited classes\r\n classesToInherit.map(constr =\u003E {\r\n //only the enumerable props\r\n Object.assign(this, new constr(instanceProps))\r\n })\r\n\r\n //set the remaining props\r\n Self.inheritProps.call(this, instanceProps)\r\n \r\n //bind the methods per object\r\n const targetProto = Object.getPrototypeOf(this)\r\n Object.getOwnPropertyNames(targetProto).map(key =\u003E {\r\n if (key !== \u0027constructor\u0027) {\r\n Object.defineProperty(this, key, {\r\n enumerable: false,\r\n value: targetProto[key] instanceof Function ?\r\n targetProto[key].bind(this) :\r\n targetProto[key]\r\n })\r\n }\r\n })\r\n\r\n //freeze the object\r\n Self.deepFreeze.call(this)\r\n }\r\n }\r\n\r\n static deepFreeze() {\r\n Object.getOwnPropertyNames(this).map(key =\u003E {\r\n if (typeof this[key] === \u0027object\u0027 \u0026\u0026 this[key] !== null)\r\n Self.deepFreeze.call(this[key])\r\n })\r\n \r\n Object.freeze(this)\r\n }\r\n\r\n static inheritProps(source) {\r\n if (!Object.isFrozen(this)) {\r\n Object.getOwnPropertyNames(source).map(key =\u003E {\r\n if (!this.hasOwnProperty(key)) {\r\n this[key] = source[key]\r\n }\r\n })\r\n }\r\n }\r\n\r\n static errorHandleMethods(shouldHandleProto = true) {\r\n if (!Object.isFrozen(this)) {\r\n const descriptors = Object.getOwnPropertyDescriptors(this)\r\n\r\n Object.getOwnPropertyNames(this).map(key =\u003E {\r\n if (descriptors[key].writable \u0026\u0026 key !== \u0027constructor\u0027) {\r\n const msg = \u0060Error inside method ${key}\u0060\r\n\r\n this[key] = this[key] instanceof Function ?\r\n Self.catchFunc({ msg, innerFunc: this[key] }) :\r\n this[key]\r\n }\r\n })\r\n \r\n if(shouldHandleProto) {\r\n Self.errorHandleMethods.call(this.prototype, false)\r\n }\r\n }\r\n }\r\n\r\n static finalizeClass({ classProps = {}, classesToInherit = [] } = {}) {\r\n if (!Object.isFrozen(this)) {\r\n // set class props\r\n Object.assign(this, classProps)\r\n\r\n // inherit methods from other classes\r\n classesToInherit.map(constr =\u003E {\r\n // class inherits static methods\r\n Self.inheritProps.call(this, constr)\r\n // class inherits prototype methods\r\n Self.inheritProps.call(this.prototype, constr.prototype)\r\n })\r\n\r\n // error handle the inherited and the original methods\r\n Self.errorHandleMethods.call(this)\r\n\r\n // freeze the constructor\r\n Self.deepFreeze.call(this)\r\n }\r\n }\r\n}\r\n\r\nUtils.finalizeClass.call(Utils, { classProps: {\r\n isBrowser: typeof window !== \u0027undefined\u0027 \u0026\u0026\r\n ({}).toString.call(window) === \u0027[object Window]\u0027,\r\n isNodeJS: typeof global !== \u0022undefined\u0022 \u0026\u0026\r\n ({}).toString.call(global) === \u0027[object global]\u0027\r\n} })\r\n\r\n\r\nconst UncaughtErrorHandler = class Self {\r\n constructor({ server, port = 3000 } = {}) {\r\n const sockets = new Set()\r\n\r\n Self.startServer({ server, port, sockets }) \r\n Self.initUncaughtErrorHandling({ server, sockets })\r\n } \r\n\r\n static startServer ({ server, port, sockets }) {\r\n if (Self.isNodeJS \u0026\u0026 server === Object(server)) {\r\n server.on(\u0027connection\u0027, socket =\u003E {\r\n console.log(\u0027Socket added\u0027)\r\n sockets.add(socket);\r\n socket.on(\u0027close\u0027, () =\u003E {\r\n console.log(\u0027Socket deleted\u0027)\r\n sockets.delete(socket)\r\n })\r\n })\r\n\r\n server.listen(port, err =\u003E {\r\n if (err) throw err\r\n console.log(\u0060Server listening on ${port}\u0060)\r\n })\r\n }\r\n }\r\n\r\n static onUncaughtError (eventOrError, { server, sockets } = {}) {\r\n const msg = \u0027Fatal error! Please restart the application...\u0027 \r\n\r\n if (Self.isBrowser) {\r\n eventOrError.preventDefault()\r\n\r\n Self.logError({\r\n msg,\r\n err: eventOrError.error || eventOrError.reason\r\n })\r\n\r\n // prevent user from interacting with the page\r\n window.document.body.style[\u0027pointer-events\u0027] = \u0027none\u0027\r\n }\r\n\r\n if (Self.isNodeJS) {\r\n if (server) server.close()\r\n if (sockets) sockets.forEach(socket =\u003E { socket.destroy() })\r\n\r\n Self.logError({\r\n msg,\r\n err: eventOrError instanceof Error ?\r\n eventOrError :\r\n new Error(\u0027Process interrupted\u0027)\r\n })\r\n\r\n // shutdown the node process\r\n setTimeout(() =\u003E process.exit(1), 1000).unref()\r\n }\r\n }\r\n\r\n static initUncaughtErrorHandling({ server, sockets } = {}) {\r\n const errorFunc = function (err) {\r\n Self.onUncaughtError.call(this, err, { server, sockets })\r\n }\r\n\r\n if (Self.isBrowser) {\r\n window.addEventListener(\u0027error\u0027, errorFunc, true)\r\n window.addEventListener(\u0027unhandledrejection\u0027, errorFunc, true)\r\n }\r\n\r\n if (Self.isNodeJS) {\r\n process.on(\u0027uncaughtException\u0027, errorFunc)\r\n process.on(\u0027unhandledRejection\u0027, errorFunc)\r\n process.on(\u0027SIGTERM\u0027, errorFunc)\r\n process.on(\u0027SIGINT\u0027, errorFunc)\r\n }\r\n }\r\n}\r\n\r\nUtils.finalizeClass.call(UncaughtErrorHandler, {\r\n classesToInherit: [ Utils ]\r\n}) \r\n\r\n\r\n\r\n\r\n\r\n\r\n/************************/\r\n/******* EXAMPLES *******/\r\n/************************/\r\n\r\n\r\n// BADLY written class\r\nclass Height {\r\n constructor(args = {}) {\r\n this.height = args.height \u002B 1000\r\n }\r\n \r\n getHeight() { return \u0060Height: ${this.height}\u0060 }\r\n \r\n throwErrorForHeight() {\r\n throw new Error(\u0027Error from instance of Height method\u0027)\r\n }\r\n}\r\n// BADLY written class\r\nclass Weight {\r\n constructor(args = {}) {\r\n this.weight = args.weight \u002B \u0027 kg\u0027\r\n }\r\n \r\n getWeight() { return \u0060Weight: ${this.weight}\u0060 }\r\n \r\n static throwErrorForWeight() {\r\n throw new Error(\u0027Error from Weight method\u0027)\r\n }\r\n}\r\n// WELL written class\r\nconst Person = class Self {\r\n constructor(args = {}) {\r\n Utils.createObject.call(this, {\r\n classesToInherit: [Height, Weight],\r\n classProps: { species: \u0027humans\u0027 },\r\n instanceProps: {\r\n name: args.name || \u0027John\u0027,\r\n age: args.age || 20,\r\n weight: args.weight || 60,\r\n height: args.height || 160\r\n }\r\n })\r\n }\r\n\r\n // Uncomment to replace the inherited one\r\n getHeight() { return \u0027Correct height\u0027 }\r\n \r\n // combines native with inherited methods\r\n greet() { console.log(\u0060Hello, ${this.name}. ${this.getWeight()}, ${this.getHeight()}\u0060) }\r\n\r\n // calculates the method name first\r\n [\u0027get\u0027 \u002B \u0027Info\u0027]() { return \u0060Name: ${this.name}, age: ${this.age}\u0060 } \r\n\r\n throwErrorForInstance() {\r\n throw new Error(\u0027Error shows up in instance methods\u0027)\r\n }\r\n\r\n // class method\r\n static internalMethod() {\r\n return \u0027Hello from inside the class\u0027\r\n }\r\n\r\n static throwErrorForPerson() {\r\n throw new Error(\u0027Error shows up in Person methods\u0027)\r\n }\r\n\r\n // can also use async, * generator\r\n // which can also be static\r\n}\r\n\r\n\r\nconst mark = new Person({ name: \u0027Mark\u0027, weight: 70 })\r\n// copy mark props and replace some of them\r\nconst fatMark = new Person({ ...mark, weight: 110 })","IsDeferred":false},{"Name":"new","Code":"const GenericUtils = class Self {\r\n static deepFreeze(obj) {\r\n Object.getOwnPropertyNames(obj).map(key =\u003E {\r\n if (typeof obj[key] === \u0027object\u0027 \u0026\u0026 obj[key] !== null)\r\n Self.deepFreeze(obj[key])\r\n })\r\n \r\n Object.freeze(obj)\r\n }\r\n\r\n static inheritProps(obj, source) {\r\n if (!Object.isFrozen(obj)) {\r\n Object.getOwnPropertyNames(source).map(key =\u003E {\r\n if (!obj.hasOwnProperty(key)) {\r\n obj[key] = source[key]\r\n }\r\n })\r\n }\r\n }\r\n\r\n static setClassProps(obj, { props = {}, inherited = [] } = {}) {\r\n if (!Object.isFrozen(obj)) {\r\n // set class props\r\n Object.assign(obj, props)\r\n\r\n // inherit methods from other classes\r\n inherited.map(constr =\u003E {\r\n // class inherits static methods\r\n Self.inheritProps(obj, constr)\r\n // class inherits prototype methods\r\n Self.inheritProps(obj.prototype, constr.prototype)\r\n })\r\n\r\n // give access to inherited classes\r\n obj.inherited = inherited\r\n }\r\n }\r\n\r\n static deepStringify (origData) {\r\n const getIsInstanceOfObject = function (val) {\r\n return typeof val === \u0027object\u0027 \u0026\u0026 val !== null\r\n }\r\n\r\n const parseForStringify = function (data) {\r\n if (Array.isArray(data)) {\r\n return data.map(el =\u003E getIsInstanceOfObject(el) ?\r\n parseForStringify(el) :\r\n el\r\n )\r\n }\r\n\r\n if (getIsInstanceOfObject(data)) {\r\n return Object.getOwnPropertyNames(data)\r\n .reduce((acc, key) =\u003E Object.assign({}, acc, {\r\n [key]: getIsInstanceOfObject(data[key]) ?\r\n parseForStringify(data[key]) :\r\n data[key]\r\n }), {})\r\n }\r\n\r\n return data\r\n }\r\n\r\n return JSON.stringify(parseForStringify(origData))\r\n }\r\n\r\n static logError(/*{ args, msg, err }*/) {\r\n const params = arguments[0] === Object(arguments[0]) ?\r\n arguments[0] :\r\n {}\r\n const args = Array.isArray(params.args) ?\r\n params.args :\r\n []\r\n const msg = typeof params.msg === \u0027string\u0027 ?\r\n params.msg :\r\n \u0027Internal error when processing some data\u0027\r\n const err = params.err instanceof Error ?\r\n params.err :\r\n new Error(\u0027Unknown error\u0027)\r\n\r\n const stringifiedArgs = Self.deepStringify(args)\r\n\r\n //log in development\r\n console.log()\r\n console.error(\u0060 Function arguments:${stringifiedArgs}\\n\u0060, err)\r\n console.log()\r\n\r\n // for the logging service\r\n const commonProps = {\r\n arguments: JSON.parse(stringifiedArgs),\r\n date: new Date().toUTCString(),\r\n error: err\r\n }\r\n\r\n if (Self.isBrowser) {\r\n //TODO notify the user\r\n alert(msg)\r\n\r\n //logging service in production\r\n console.info(Self.deepStringify({\r\n ...commonProps,\r\n localUrl: window.location.href,\r\n machineInfo: {\r\n browserInfo: window.navigator.userAgent,\r\n language: window.navigator.language,\r\n osType: window.navigator.platform\r\n }\r\n }))\r\n }\r\n\r\n if (Self.isNodeJS) {\r\n //logging service in production\r\n console.info(Self.deepStringify({\r\n ...commonProps,\r\n localUrl: __filename,\r\n machineInfo: {\r\n cpuArch: process.arch,\r\n osType: process.platform,\r\n depVersions: process.versions\r\n }\r\n }))\r\n }\r\n }\r\n\r\n static catchFunc({ msg, defaultVal, innerFunc } = {}) {\r\n if (typeof innerFunc !== \u0027function\u0027) {\r\n Self.logError({\r\n err: new Error(\u0060Was not given a function - ${innerFunc}\u0060)\r\n })\r\n\r\n return defaultVal\r\n }\r\n\r\n if (innerFunc instanceof (async () =\u003E {}).constructor) {\r\n return async function(...args) {\r\n try {\r\n return await innerFunc.apply(this, args)\r\n } catch(err) {\r\n Self.logError({ err, args, msg })\r\n\r\n return defaultVal\r\n }\r\n }\r\n }\r\n\r\n return function(...args) {\r\n try {\r\n return innerFunc.apply(this, args)\r\n } catch(err) {\r\n Self.logError({ err, args, msg })\r\n\r\n return defaultVal\r\n }\r\n }\r\n }\r\n\r\n static errorHandleMethods(obj, shouldHandleProto = true) {\r\n if (!Object.isFrozen(obj)) {\r\n const descriptors = Object.getOwnPropertyDescriptors(obj)\r\n\r\n Object.getOwnPropertyNames(obj).map(key =\u003E {\r\n if (descriptors[key].writable \u0026\u0026 key !== \u0027constructor\u0027) {\r\n const msg = \u0060Error inside method ${key}\u0060\r\n\r\n obj[key] = obj[key] instanceof Function ?\r\n Self.catchFunc({ msg, innerFunc: obj[key] }) :\r\n obj[key]\r\n }\r\n })\r\n \r\n if(shouldHandleProto) {\r\n Self.errorHandleMethods(obj.prototype, false)\r\n }\r\n }\r\n }\r\n}\r\n\r\nGenericUtils.setClassProps(GenericUtils, { props: {\r\n isBrowser: typeof window !== \u0027undefined\u0027 \u0026\u0026\r\n ({}).toString.call(window) === \u0027[object Window]\u0027,\r\n isNodeJS: typeof global !== \u0022undefined\u0022 \u0026\u0026\r\n ({}).toString.call(global) === \u0027[object global]\u0027\r\n} })\r\nGenericUtils.errorHandleMethods(GenericUtils, true)\r\nGenericUtils.deepFreeze(GenericUtils)\r\n\r\nconst PureClass = class Self {\r\n constructor(instanceProps = {}) {\r\n if (!Object.isFrozen(this)) {\r\n //get the props from the inherited classes\r\n const inherited = this.constructor.inherited || []\r\n\r\n inherited.map(constr =\u003E {\r\n //only the enumerable props\r\n Object.assign(this, new constr(instanceProps))\r\n })\r\n\r\n //set the remaining props\r\n GenericUtils.inheritProps(this, instanceProps)\r\n \r\n const targetProto = Object.getPrototypeOf(this)\r\n\r\n //bind the methods per object\r\n Object.getOwnPropertyNames(targetProto).map(key =\u003E {\r\n if (key !== \u0027constructor\u0027) {\r\n Object.defineProperty(this, key, {\r\n enumerable: false,\r\n value: targetProto[key] instanceof Function ?\r\n targetProto[key].bind(this) :\r\n targetProto[key]\r\n })\r\n }\r\n })\r\n\r\n //seal the object shallowly, if you want deepFreeze,\r\n //implement it after creation - GenericUtils.deepFreeze(objName)\r\n Object.seal(this)\r\n }\r\n }\r\n\r\n static finalizeClass({ props = {}, inherited = [] } = {}) {\r\n if (!Object.isFrozen(this)) {\r\n GenericUtils.setClassProps(this, { props, inherited })\r\n\r\n // error handle the inherited and the original methods\r\n GenericUtils.errorHandleMethods(this)\r\n\r\n // freeze the whole class\r\n GenericUtils.deepFreeze(this)\r\n }\r\n }\r\n}\r\n\r\nGenericUtils.errorHandleMethods(PureClass, true)\r\nGenericUtils.deepFreeze(PureClass)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/************************/\r\n/******* EXAMPLES *******/\r\n/************************/\r\n\r\n\r\n// BADLY written class\r\nclass Height {\r\n constructor(args = {}) {\r\n this.height = args.height \u002B 1000\r\n }\r\n \r\n getHeight() { return \u0060Height: ${this.height}\u0060 }\r\n \r\n throwErrorForHeight() {\r\n throw new Error(\u0027Error from instance of Height method\u0027)\r\n }\r\n}\r\n// BADLY written class\r\nclass Weight {\r\n constructor(args = {}) {\r\n this.weight = args.weight \u002B \u0027 kg\u0027\r\n }\r\n \r\n getWeight() { return \u0060Weight: ${this.weight}\u0060 }\r\n \r\n static throwErrorForWeight() {\r\n throw new Error(\u0027Error from Weight method\u0027)\r\n }\r\n}\r\n\r\n// WELL written class\r\nconst Person = class Self extends PureClass {\r\n constructor(args = {}) {\r\n super({\r\n name: args.name || \u0027John\u0027,\r\n age: args.age || 20,\r\n weight: args.weight || 60,\r\n height: args.height || 160\r\n })\r\n }\r\n\r\n // Uncomment to replace the inherited one\r\n getHeight() { return \u0027Correct height\u0027 }\r\n \r\n // combines native with inherited methods\r\n greet() { console.log(\u0060Hello, ${this.name}. ${this.getWeight()}, ${this.getHeight()}\u0060) }\r\n\r\n // calculates the method name first\r\n [\u0027get\u0027 \u002B \u0027Info\u0027]() { return \u0060Name: ${this.name}, age: ${this.age}\u0060 } \r\n\r\n throwErrorForInstance() {\r\n throw new Error(\u0027Error shows up in instance methods\u0027)\r\n }\r\n\r\n // class method\r\n static internalMethod() {\r\n return \u0027Hello from inside the class\u0027\r\n }\r\n\r\n static throwErrorForPerson() {\r\n throw new Error(\u0027Error shows up in Person methods\u0027)\r\n }\r\n\r\n // can also use async, * generator\r\n // which can also be static\r\n}\r\n\r\nPerson.finalizeClass({\r\n inherited: [Height, Weight],\r\n props: { species: \u0027humans\u0027 }\r\n})\r\n\r\n\r\nconst mark = new Person({ name: \u0027Mark\u0027, weight: 70 })\r\n// copy mark props and replace some of them\r\nconst fatMark = new Person({ ...mark, weight: 110 })\r\n\r\n\r\nconst UncaughtErrorHandler = class Self extends PureClass {\r\n constructor({ server, port = 3000 } = {}) {\r\n super({ sockets: new Set(), server, port })\r\n } \r\n\r\n static onUncaughtError (eventOrError) {\r\n const msg = \u0027Fatal error! Please restart the application...\u0027 \r\n\r\n if (Self.isBrowser) {\r\n eventOrError.preventDefault()\r\n\r\n Self.logError({\r\n msg,\r\n err: eventOrError.error || eventOrError.reason\r\n })\r\n\r\n // prevent user from interacting with the page\r\n window.document.body.style[\u0027pointer-events\u0027] = \u0027none\u0027\r\n }\r\n\r\n if (Self.isNodeJS) {\r\n if (this.server !== undefined)\r\n this.server.close()\r\n if (this.sockets !== undefined)\r\n this.sockets.forEach(socket =\u003E { socket.destroy() })\r\n\r\n Self.logError({\r\n msg,\r\n err: eventOrError instanceof Error ?\r\n eventOrError :\r\n new Error(\u0027Process interrupted\u0027)\r\n })\r\n\r\n // shutdown the node process\r\n setTimeout(() =\u003E process.exit(1), 1000).unref()\r\n }\r\n }\r\n\r\n startServer () {\r\n if (Self.isNodeJS \u0026\u0026 this.server !== undefined) {\r\n this.server.on(\u0027connection\u0027, socket =\u003E {\r\n console.log(\u0027Socket added\u0027)\r\n this.sockets.add(socket);\r\n\r\n socket.on(\u0027close\u0027, () =\u003E {\r\n console.log(\u0027Socket deleted\u0027)\r\n this.sockets.delete(socket)\r\n })\r\n })\r\n\r\n this.server.listen(this.port, err =\u003E {\r\n if (err) throw err\r\n console.log(\u0060Server listening on ${this.port}\u0060)\r\n })\r\n }\r\n }\r\n\r\n initUncaughtErrorHandling() {\r\n const errorFunc = Self.onUncaughtError.bind(this)\r\n\r\n if (Self.isBrowser) {\r\n window.addEventListener(\u0027error\u0027, errorFunc, true)\r\n window.addEventListener(\u0027unhandledrejection\u0027, errorFunc, true)\r\n }\r\n\r\n if (Self.isNodeJS) {\r\n this.startServer()\r\n\r\n process.on(\u0027uncaughtException\u0027, errorFunc)\r\n process.on(\u0027unhandledRejection\u0027, errorFunc)\r\n process.on(\u0027SIGTERM\u0027, errorFunc)\r\n process.on(\u0027SIGINT\u0027, errorFunc)\r\n }\r\n }\r\n}\r\n\r\nUncaughtErrorHandler.finalizeClass({ inherited: [GenericUtils] })","IsDeferred":false}]}