26 lines
570 B
JavaScript
26 lines
570 B
JavaScript
const State = require('../State')
|
|
|
|
class IsAliveState extends State {
|
|
async apply() {
|
|
throw new Error('IsAliveState cannot be applied. It is a check measure only.')
|
|
}
|
|
|
|
async check() {
|
|
return this._host.is_alive()
|
|
}
|
|
|
|
async reverse() {
|
|
throw new Error('IsAliveState cannot be reversed. It is a check measure only.')
|
|
}
|
|
|
|
failure_message() {
|
|
return `Unable to connect to host "${this._host.name}".`
|
|
}
|
|
|
|
check_message() {
|
|
return this.failure_message()
|
|
}
|
|
}
|
|
|
|
module.exports = exports = IsAliveState
|