Skip to content

Commit 6807185

Browse files
committed
doc: document potential errors
1 parent a31b6e4 commit 6807185

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/interfaces/src/protocols.ts

+18
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,29 @@ export type Callback<T extends IDecodedMessage> = (
5959
) => void | Promise<void>;
6060

6161
export enum SendError {
62+
/** Could not determine the origin of the fault. Best to check connectivity and try again */
6263
GENERIC_FAIL = "Generic error",
64+
/** Failure to protobuf encode the message. This is not recoverable and needs
65+
* further investigation. */
6366
ENCODE_FAILED = "Failed to encode",
67+
/** Failure to protobuf decode the message. May be due to a remote peer issue,
68+
* ensuring that messages are sent via several peer enable mitigation of this error.. */
6469
DECODE_FAILED = "Failed to decode",
70+
/** The message size is above the maximum message size allowed on the Waku Network.
71+
* Compressing the message or using an alternative strategy for large messages is recommended.
72+
*/
6573
SIZE_TOO_BIG = "Size is too big",
74+
/**
75+
* Failure to find a peer with suitable protocols. This may due to a connection issue.
76+
* Mitigation can be: retrying after a given time period, display connectivity issue
77+
* to user or listening for `peer:connected:bootstrap` or `peer:connected:peer-exchange`
78+
* on the connection manager before retrying.
79+
*/
6680
NO_PEER_AVAILABLE = "No peer available",
81+
/**
82+
* The remote peer did not behave as expected. Mitigation from `NO_PEER_AVAILABLE`
83+
* or `DECODE_FAILED` can be used.
84+
*/
6785
REMOTE_PEER_FAULT = "Remote peer fault"
6886
}
6987

0 commit comments

Comments
 (0)