diff --git a/error-codes/README.md b/error-codes/README.md index 8ad86912..cb2365e1 100644 --- a/error-codes/README.md +++ b/error-codes/README.md @@ -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. diff --git a/error-codes/libp2p-error-codes.md b/error-codes/libp2p-error-codes.md new file mode 100644 index 00000000..08e06aa8 --- /dev/null +++ b/error-codes/libp2p-error-codes.md @@ -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 |