webssh2/socket/index.js
billchurch 2c1c3ac911 error handling fixups
added some additional error handing functions and debugging points
- `DEBUG=ssh` will put the ssh2 module into debug mode
- `debug=WebSSH2` will output additional debug messages for functions
and events in the application (not including the ssh2 module debug)
- created socket/index.js to start the process of separating out app
functions, just holds error logging function at this point
- corrected some events on public/client.js so the primary error cause
is not overwritten
- ensure that ssh connection is terminated when websocked is
disconnected by the client
2017-05-20 17:26:18 -04:00

11 lines
361 B
JavaScript

var myError = myError
module.exports = function (socket, io) {
this.SSHerror = function (myFunc, err) {
myError = (myError) ? myError : ((err) ? err.message:undefined)
thisError = (myError) ? ': ' + myError : ''
console.error('SSH ' + myFunc + thisError)
socket.emit('ssherror', 'SSH ' + myFunc + thisError)
socket.disconnect(true)
}
}