Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/strapi/node_modules/@sentry/node/esm/integrations/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import { getCurrentHub } from '@sentry/core';
import { consoleSandbox } from '@sentry/utils';
import { logAndExitProcess } from '../handlers';
/** Global Promise Rejection handler */
var OnUnhandledRejection = /** @class */ (function () {
/**
* @inheritDoc
*/
function OnUnhandledRejection(_options) {
if (_options === void 0) { _options = { mode: 'warn' }; }
this._options = _options;
/**
* @inheritDoc
*/
this.name = OnUnhandledRejection.id;
}
/**
* @inheritDoc
*/
OnUnhandledRejection.prototype.setupOnce = function () {
global.process.on('unhandledRejection', this.sendUnhandledPromise.bind(this));
};
/**
* Send an exception with reason
* @param reason string
* @param promise promise
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
OnUnhandledRejection.prototype.sendUnhandledPromise = function (reason, promise) {
var hub = getCurrentHub();
if (!hub.getIntegration(OnUnhandledRejection)) {
this._handleRejection(reason);
return;
}
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
var context = (promise.domain && promise.domain.sentryContext) || {};
hub.withScope(function (scope) {
scope.setExtra('unhandledPromiseRejection', true);
// Preserve backwards compatibility with raven-node for now
if (context.user) {
scope.setUser(context.user);
}
if (context.tags) {
scope.setTags(context.tags);
}
if (context.extra) {
scope.setExtras(context.extra);
}
hub.captureException(reason, { originalException: promise });
});
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
this._handleRejection(reason);
};
/**
* Handler for `mode` option
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
OnUnhandledRejection.prototype._handleRejection = function (reason) {
// https://github.com/nodejs/node/blob/7cf6f9e964aa00772965391c23acda6d71972a9a/lib/internal/process/promises.js#L234-L240
var rejectionWarning = 'This error originated either by ' +
'throwing inside of an async function without a catch block, ' +
'or by rejecting a promise which was not handled with .catch().' +
' The promise rejected with the reason:';
/* eslint-disable no-console */
if (this._options.mode === 'warn') {
consoleSandbox(function () {
console.warn(rejectionWarning);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
console.error(reason && reason.stack ? reason.stack : reason);
});
}
else if (this._options.mode === 'strict') {
consoleSandbox(function () {
console.warn(rejectionWarning);
});
logAndExitProcess(reason);
}
/* eslint-enable no-console */
};
/**
* @inheritDoc
*/
OnUnhandledRejection.id = 'OnUnhandledRejection';
return OnUnhandledRejection;
}());
export { OnUnhandledRejection };
//# sourceMappingURL=onunhandledrejection.js.map |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0135 ]-- |