grpc-js-helper
v0.3.0
Published
Some useful items for playing with `@grpc/grpc-js`.
Downloads
6
Readme
grpc-js-helper
Some useful items for playing with @grpc/grpc-js
.
Usage
import { ServiceError, ServiceStatus, serviceCall } from 'grpc-js-helper';
// ..
try {
const result = await serviceCall(serviceClient.method1());
} catch (error) {
if (error instanceof ServiceError) {
switch (error.code) {
case ServiceStatus.UNAVAILABLE:
// do something
break;
}
} else {
// should be unreachable
}
}