Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case 504:
return CanonicalCode.DEADLINE_EXCEEDED;
case 404:
return CanonicalCode.NOT_FOUND;
case 403:
return CanonicalCode.PERMISSION_DENIED;
case 401:
return CanonicalCode.UNAUTHENTICATED;
case 429:
return CanonicalCode.RESOURCE_EXHAUSTED;
case 501:
return CanonicalCode.UNIMPLEMENTED;
case 503:
return CanonicalCode.UNAVAILABLE;
default:
return CanonicalCode.UNKNOWN;
}
}
}
const patchedEnd = function(this: redis.RedisClient, err?: Error) {
if (err instanceof Error) {
span.setStatus(CanonicalCode.UNKNOWN, err.message);
} else {
span.setStatus(CanonicalCode.OK);
}
span.end();
return resultHandler.apply(this, arguments);
};
return this.tracer.wrap(patchedEnd);
request.on('error', (err: Error) => {
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_NAME, err.name)
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_MESSAGE, err.message)
span.setStatus(CanonicalCode.UNKNOWN, err.message)
span.end()
})
request.on('error', error => {
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_NAME, error.name);
span.addAttribute(
HttpPlugin.ATTRIBUTE_HTTP_ERROR_MESSAGE,
error.message
);
span.setStatus(CanonicalCode.UNKNOWN, error.message);
span.end();
});
const patchedEnd = function(this: ioredis.Redis, err?: Error) {
if (err instanceof Error) {
span.setStatus(CanonicalCode.UNKNOWN, err.message);
}
span.end();
if (typeof resultHandler === 'function') {
return resultHandler.apply(this, arguments);
}
};
return this.tracer.wrap(patchedEnd);
response.on('error', error => {
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_NAME, error.name)
span.addAttribute(
HttpPlugin.ATTRIBUTE_HTTP_ERROR_MESSAGE, error.message)
span.setStatus(CanonicalCode.UNKNOWN)
span.end()
})
})
request.on('error', error => {
span.addAttribute(HttpPlugin.ATTRIBUTE_HTTP_ERROR_NAME, error.name)
span.addAttribute(
HttpPlugin.ATTRIBUTE_HTTP_ERROR_MESSAGE, error.message)
span.setStatus(CanonicalCode.UNKNOWN)
span.end()
})