grpc-js-helper
TypeScript icon, indicating that this package has built-in type declarations

0.2.4 • Public • Published

grpc-js-helper

CI

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
    }
}

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i grpc-js-helper

Weekly Downloads

4

Version

0.2.4

License

MIT

Unpacked Size

7.18 kB

Total Files

7

Last publish

Collaborators

  • magiclen