Open
Description
This is a feature request
Problem
For protocol implementations (eg Filter), we have access to certain statusCode
that the remote peer might respond with.
Based on specific statusCode
, returning and handling errors appropriately would be great devex.
Proposed Solutions
Map error codes received from remote peers into tangible errors
Notes
We currently do follow generic error handling based on statusCode
but the aim is to do it for more precise error codes:
const { statusCode, requestId, statusDesc } =
FilterSubscribeResponse.decode(res[0].slice());
if (statusCode < 200 || statusCode >= 300) {
log.error(
`Filter unsubscribe all request ${requestId} failed with status code ${statusCode}: ${statusDesc}`
);
return {
failure: {
error: ProtocolError.REMOTE_PEER_REJECTED,
peerId: peer.id
},
success: null
};
}
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
To Do