ElementsProject / ElementsProject/lightning

gRPC status codes to correspond error types

Open
#9,127 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
3.1k
Forks
1k
Avg merge
4d 10h
Merged PRs (30d)
13

Description

Currently gRPC errors have always a status code of either `internal `or `unknown`.

It would be helpful for generic error handling in apps using CLN gRPC, if the full range of standard status codes were used: https://grpc.io/docs/guides/status-codes/

There could be mapping from the json rpc error codes to gRPC error codes.

Some examples:
* `JSONRPC2_INVALID_PARAMS = -32602` → `INVALID_ARGUMENT (3)`
* `LIGHTNINGD_SHUTDOWN = -5` → `UNAVAILABLE (14)`
* `PAY_NO_SUCH_PAYMENT = 208` → `NOT_FOUND (5)`
* `PAY_INSUFFICIENT_FUNDS = 215` → `FAILED_PRECONDITION (9)` / `RESOURCE_EXHAUSTED (8)`
* `SIGNMESSAGE_PUBKEY_NOT_FOUND = 1301` → `NOT_FOUND (5)`
* `OFFER_TIMEOUT = 1005` → `DEADLINE_EXCEEDED (4)`
* `RUNE_NOT_AUTHORIZED = 1501` → `PERMISSION_DENIED (7)`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.