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) /var/www/html/wincloud_gateway/node_modules/graphql-tools/dist/generate/ drwxr-xr-x | |
| Viewing file: Select action/file-type: Object.defineProperty(exports, "__esModule", { value: true });
var graphql_1 = require("graphql");
/*
* fn: The function to decorate with the logger
* logger: an object instance of type Logger
* hint: an optional hint to add to the error's message
*/
function decorateWithLogger(fn, logger, hint) {
if (typeof fn === 'undefined') {
fn = graphql_1.defaultFieldResolver;
}
var logError = function (e) {
// TODO: clone the error properly
var newE = new Error();
newE.stack = e.stack;
/* istanbul ignore else: always get the hint from addErrorLoggingToSchema */
if (hint) {
newE['originalMessage'] = e.message;
newE['message'] = "Error in resolver " + hint + "\n" + e.message;
}
logger.log(newE);
};
return function (root, args, ctx, info) {
try {
var result = fn(root, args, ctx, info);
// If the resolve function returns a Promise log any Promise rejects.
if (result &&
typeof result.then === 'function' &&
typeof result.catch === 'function') {
result.catch(function (reason) {
// make sure that it's an error we're logging.
var error = reason instanceof Error ? reason : new Error(reason);
logError(error);
// We don't want to leave an unhandled exception so pass on error.
return reason;
});
}
return result;
}
catch (e) {
logError(e);
// we want to pass on the error, just in case.
throw e;
}
};
}
exports.default = decorateWithLogger;
//# sourceMappingURL=decorateWithLogger.js.map |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0391 ]-- |