Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const getLogger = (ctx: Context): Logger => {
// tslint:disable-next-line:no-any
const { state } = ctx as any;
if (state == undefined) {
throw new GRPCError('Programming error', grpc.status.INTERNAL);
}
const { logger } = state;
if (logger == undefined) {
throw new GRPCError('Programming error', grpc.status.INTERNAL);
}
return logger;
};
export const getMonitor = (ctx: Context): Monitor => {
const { state } = ctx;
if (state == null) {
throw new GRPCError('Programming error', grpc.status.INTERNAL);
}
const { monitor } = state;
if (monitor == null) {
throw new GRPCError('Programming error', grpc.status.INTERNAL);
}
return monitor;
};