Skip to content

gRPC status codes to correspond error types #9127

@Jhoyola

Description

@Jhoyola

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 = -32602INVALID_ARGUMENT (3)
  • LIGHTNINGD_SHUTDOWN = -5UNAVAILABLE (14)
  • PAY_NO_SUCH_PAYMENT = 208NOT_FOUND (5)
  • PAY_INSUFFICIENT_FUNDS = 215FAILED_PRECONDITION (9) / RESOURCE_EXHAUSTED (8)
  • SIGNMESSAGE_PUBKEY_NOT_FOUND = 1301NOT_FOUND (5)
  • OFFER_TIMEOUT = 1005DEADLINE_EXCEEDED (4)
  • RUNE_NOT_AUTHORIZED = 1501PERMISSION_DENIED (7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions