Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onClientError(err, socket) {
// ignore when there is no http body, it almost like an ECONNRESET
if (err.rawPacket) {
this.logger.warn('A client (%s:%d) error [%s] occurred: %s',
socket.remoteAddress,
socket.remotePort,
err.code,
err.message);
}
if (typeof this.config.onClientError === 'function') {
const p = eggUtils.callFn(this.config.onClientError, [ err, socket, this ]);
// the returned object should like:
//
// {
// body: '...',
// headers: {
// ...
// },
// status: 400
// }
//
// default values:
//
// + body: ''
// + headers: {}
// + status: 400