Skip to content

Commit

Permalink
add some canonical error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt committed Sep 10, 2024
1 parent 070f090 commit d0db0b2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions error-codes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ connection.
For stream resets, when the underlying transport supports it, implementations
SHOULD allow sending an error code on both closing the read side of the stream, and resetting the write side of the stream.

## Libp2p Error Codes
TODO!
## Libp2p Reserved Error Codes
see [Libp2p error codes](./libp2p-error-codes.md) for the libp2p reserved error codes.

## Wire Encoding
Different transports will encode the 32-bit error code differently.
Expand Down
19 changes: 19 additions & 0 deletions error-codes/libp2p-error-codes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Libp2p error codes

## TODO!
make this a CSV

## Error Codes

| Name | Code | Description |
| --- | --- | --- |
| NO_ERROR | 0 | No reason provided for disconnection. This is equivalent to closing a connection or resetting a stream without any error code. |
| Reserved For Transport | 0x1 - 0x1000 | Reserved for transport errors
| GATED | 0x1001 | Connection rejected because the connection was gated. Most likely the IP / node is blacklisted. |
| RESOURCE_LIMIT_EXCEEDED | 0x1002 | Connection rejected because we ran into a resource limit. Implementations MAY retry with a backoff |
| PROTOCOL_VIOLATION | 0x1003 | The peer violated the protocol. |
| SUPPLANTED | 0x1004 | Connection Closed because a better connection was available |
| GARBAGE_COLLECTED | 0x1005 | The connection was garbage collected. |
| SHUTDOWN | 0x1006 | The node is going down. |
| PROTOCOL_NEGOTIATION_FAILED | 0x1007 | Rejected because we couldn't negotiate a protocol |
| BAD_REQUEST | 0x1008 | Rejected because the request was invalid |

0 comments on commit d0db0b2

Please sign in to comment.