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)
Currently gRPC errors have always a status code of either
internalorunknown.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)