diff --git a/packages/interfaces/src/protocols.ts b/packages/interfaces/src/protocols.ts index aa98bef560..62daf66df2 100644 --- a/packages/interfaces/src/protocols.ts +++ b/packages/interfaces/src/protocols.ts @@ -59,11 +59,29 @@ export type Callback = ( ) => void | Promise; export enum SendError { + /** Could not determine the origin of the fault. Best to check connectivity and try again */ GENERIC_FAIL = "Generic error", + /** Failure to protobuf encode the message. This is not recoverable and needs + * further investigation. */ ENCODE_FAILED = "Failed to encode", + /** Failure to protobuf decode the message. May be due to a remote peer issue, + * ensuring that messages are sent via several peer enable mitigation of this error.. */ DECODE_FAILED = "Failed to decode", + /** The message size is above the maximum message size allowed on the Waku Network. + * Compressing the message or using an alternative strategy for large messages is recommended. + */ SIZE_TOO_BIG = "Size is too big", + /** + * Failure to find a peer with suitable protocols. This may due to a connection issue. + * Mitigation can be: retrying after a given time period, display connectivity issue + * to user or listening for `peer:connected:bootstrap` or `peer:connected:peer-exchange` + * on the connection manager before retrying. + */ NO_PEER_AVAILABLE = "No peer available", + /** + * The remote peer did not behave as expected. Mitigation from `NO_PEER_AVAILABLE` + * or `DECODE_FAILED` can be used. + */ REMOTE_PEER_FAULT = "Remote peer fault" }