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AAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;QACrD,cAAc,EAAE,OAAO,CAAC,CAAC,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI;QAC9E,KAAK;QACL,EAAE,EAAE,kBAAkB;QACtB,OAAO;QACP,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,QAAQ,EAAE,CAAC,CAAC,KAAK;SAClB;KACF,CAAC;IAEF,OAAO;QACL,GAAG,IAAI;QACP,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC,gBAAgB;KACvC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,CAAM;IAC7B,IAAI,KAAY,CAAC;IACjB,IAAI,CAAC,YAAY,KAAK,EAAE;QACtB,KAAK,GAAG,CAAC,CAAC;KACX;SAAM;QACL,kEAAkE;QAClE,qEAAqE;QACrE,mEAAmE;QACnE,wDAAwD;QACxD,KAAK,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;KAC/B;IAED,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,cAAc;IACd,eAAe;IACf,cAAc;CACf,CAAC;AAEF,kBAAe,UAAU,CAAC","sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport parseErrorStack from '../parseErrorStack';\n\ntype ExtendedError = any;\n\nclass SyntheticError extends Error {\n name: string = '';\n}\n\n/**\n * Handles the developer-visible aspect of errors and exceptions\n */\nlet exceptionID = 0;\n\nfunction parseException(e: ExtendedError, isFatal: boolean) {\n const stack = parseErrorStack(e?.stack);\n const currentExceptionID = ++exceptionID;\n const originalMessage = e.message || '';\n let message = originalMessage;\n if (e.componentStack != null) {\n message += `\\n\\nThis error is located at:${e.componentStack}`;\n }\n const namePrefix = e.name == null || e.name === '' ? '' : `${e.name}: `;\n\n if (!message.startsWith(namePrefix)) {\n message = namePrefix + message;\n }\n\n message = e.jsEngine == null ? message : `${message}, js engine: ${e.jsEngine}`;\n\n const data = {\n message,\n originalMessage: message === originalMessage ? null : originalMessage,\n name: e.name == null || e.name === '' ? null : e.name,\n componentStack: typeof e.componentStack === 'string' ? e.componentStack : null,\n stack,\n id: currentExceptionID,\n isFatal,\n extraData: {\n jsEngine: e.jsEngine,\n rawStack: e.stack,\n },\n };\n\n return {\n ...data,\n isComponentError: !!e.isComponentError,\n };\n}\n\n/**\n * Logs exceptions to the (native) console and displays them\n */\nfunction handleException(e: any) {\n let error: Error;\n if (e instanceof Error) {\n error = e;\n } else {\n // Workaround for reporting errors caused by `throw 'some string'`\n // Unfortunately there is no way to figure out the stacktrace in this\n // case, so if you ended up here trying to trace an error, look for\n // `throw '<error message>'` somewhere in your codebase.\n error = new SyntheticError(e);\n }\n\n require('../../LogBox').default.addException(parseException(error, true));\n}\n\nconst ErrorUtils = {\n parseException,\n handleException,\n SyntheticError,\n};\n\nexport default ErrorUtils;\n"]}