Socket
Socket
Sign inDemoInstall

@eeston/grpc-error

Package Overview
Dependencies
37
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @eeston/grpc-error

Utility Error class suitable for gRPC error responses


Version published
Weekly downloads
2
Maintainers
1
Created
Weekly downloads
 

Readme

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')
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

Last updated on 07 Apr 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc