A utility library for creating gRPC error objects with standard gRPC status codes. Version 1.1.6 is the latest release, with no recent updates since 2019. It provides a simple factory for all 16 gRPC error types (e.g., AlreadyExistsError, NotFoundError) as error subclasses. Unlike manually constructing gRPC errors, this package ensures correct status codes and messages. It ships TypeScript types and supports ESM via import. Suitable for Node.js gRPC servers.
npm install grpc-errorsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates importing and throwing various gRPC errors, accessing code, message, and name properties.
Consider using @grpc/grpc-js's built-in status object or gRPC error utilities.
Install peer dep: npm install grpc (the older one) or migrate to @grpc/grpc-js and manually create status errors.
Use the .code property (e.g., grpc.status.ALREADY_EXISTS) for interop.
Upgrade to 1.1.0+ or write own typings.
npm install grpc
Use `import { AlreadyExistsError } from 'grpc-errors'`Update to v1.1.0+ which includes typings, or add custom type declaration