Skip to content
Prev Previous commit
Next Next commit
add a CODE_OUT_RANGE error code
  • Loading branch information
sukunrt committed Jan 29, 2025
commit 4eca305185c7aef219e936bef76c48b1ab0a8b43
2 changes: 1 addition & 1 deletion error-codes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Error code 0 signals that no error code was provided. Implementations MUST handl

Error codes from 1 to 100 are reserved for transport errors. These are used by the transports to terminate connections on transport errors.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make these ranges that fit neatly into a bit mask? It'll look and feel nicer to say transport errors are error codes between 0x01 and 0x7f. Same for the libp2p reserved error codes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


Error codes from 100 - 10000 are reserved for libp2p. This includes multistream error codes, as it is necessary for libp2p connection establishment over TCP, but not kad-dht or gossip-sub error codes.
Error codes from 100 - 10000 are reserved for libp2p. This includes multistream error codes, as it is necessary for libp2p connection establishment over TCP, but not kad-dht or gossip-sub error codes. Some transports, like QUIC, support sending an error code greater than a 32 bit int. On receiving such a value, implementations MUST use `CODE_OUT_OF_RANGE` as the libp2p error code.

see [Libp2p error codes](./libp2p-error-codes.md) for the libp2p reserved error
codes.
Expand Down
2 changes: 2 additions & 0 deletions error-codes/libp2p-error-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
| GARBAGE_COLLECTED | 106 | Connection was garbage collected |
| SHUTDOWN | 107 | The node is shutting down |
| GATED | 108 | The connection was gated. Most likely the IP / node is blacklisted. |
| CODE_OUT_OF_RANGE | 109 | The error code received from the peer was greater than 4294967295(Max uint32).


## Stream Error Codes
Expand All @@ -28,3 +29,4 @@
| GARBAGE_COLLECTED | 106 | Idle Stream was garbage collected |
| SHUTDOWN | 107 | The node is shutting down |
| GATED | 108 | The stream was gated. Most likely the IP / node is blacklisted. |
| CODE_OUT_OF_RANGE | 109 | The error code received from the peer was greater than 4294967295(Max uint32).