Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grpc-error

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-error

Utility Error class suitable for gRPC error responses

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7K
decreased by-3.92%
Maintainers
1
Weekly downloads
 
Created
Source

grpc-error

Utility Error class suitable for gRPC error responses

grpc-create-error - A helper function module that this class uses

grpc status codes - The grpc status codes.

Usage

const GRPCError = require('grpc-error')
const grpc = require('@grpc/grpc-js')
const error = new GRPCError('Boom', grpc.status.INVALID_ARGUMENT)
const GRPCError = require('grpc-error')

const error = new GRPCError('Boom', 2000, { status_code: 'INVALID_TOKEN' )
console.log(err instanceof Error) // true
console.log(err.message) // 'Boom'
console.log(err.code) // 2000
console.log(err.metadata instanceof grpc.Metadata) // true
console.log(err.metadata.getMap()) // { status_code: 'INVALID_TOKEN' }
const GRPCError = require('grpc-error')

const error = new GRPCError('Boom', { status_code: 'INVALID_TOKEN' )
console.log(err instanceof Error) // true
console.log(err.message) // 'Boom'
console.log(err.metadata instanceof grpc.Metadata) // true
console.log(err.metadata.getMap()) // { status_code: 'INVALID_TOKEN' }

License

Apache-2.0

Keywords

FAQs

Package last updated on 19 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc