in packages/dubbo-node/src/node-error.ts [120:178]
export function connectErrorFromH2ResetCode(
rstCode: number
): ConnectError | undefined {
switch (rstCode) {
case H2Code.PROTOCOL_ERROR:
case H2Code.INTERNAL_ERROR:
case H2Code.FLOW_CONTROL_ERROR:
case H2Code.SETTINGS_TIMEOUT:
case H2Code.FRAME_SIZE_ERROR:
case H2Code.COMPRESSION_ERROR:
case H2Code.CONNECT_ERROR:
return new ConnectError(
`http/2 stream closed with error code ${
H2Code[rstCode]
} (0x${rstCode.toString(16)})`,
Code.Internal
);
case H2Code.REFUSED_STREAM:
return new ConnectError(
`http/2 stream closed with error code ${
H2Code[rstCode]
} (0x${rstCode.toString(16)})`,
Code.Unavailable
);
case H2Code.CANCEL:
return new ConnectError(
`http/2 stream closed with error code ${
H2Code[rstCode]
} (0x${rstCode.toString(16)})`,
Code.Canceled
);
case H2Code.ENHANCE_YOUR_CALM:
return new ConnectError(
`http/2 stream closed with error code ${
H2Code[rstCode]
} (0x${rstCode.toString(16)})`,
Code.ResourceExhausted
);
case H2Code.INADEQUATE_SECURITY:
return new ConnectError(
`http/2 stream closed with error code ${
H2Code[rstCode]
} (0x${rstCode.toString(16)})`,
Code.PermissionDenied
);
case H2Code.HTTP_1_1_REQUIRED:
return new ConnectError(
`http/2 stream closed with error code ${
H2Code[rstCode]
} (0x${rstCode.toString(16)})`,
Code.PermissionDenied
);
case H2Code.STREAM_CLOSED:
default:
// Intentionally not mapping STREAM_CLOSED (0x5), see https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#errors
break;
}
return undefined;
}