How to use grpc-error - 2 common examples

To help you get started, we’ve selected a few grpc-error examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neo-one-suite / neo-one / packages / neo-one-server / src / middleware / common.ts View on Github external
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;
};
github neo-one-suite / neo-one / packages / neo-one-server / src / middleware / common.js View on Github external
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;
};

grpc-error

Utility Error class suitable for gRPC error responses

Apache-2.0
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular grpc-error functions