File size: 495 Bytes
36ba3ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const Observation = require("./base.js").Observation;

class onError extends Observation {
    constructor(bot) {
        super(bot);
        this.name = "onError";
        this.obs = null;
        bot.on("error", (err) => {
            // Save entity status to local variable
            this.obs = err;
            this.bot.event(this.name);
        });
    }

    observe() {
        const result = this.obs;
        this.obs = null;
        return result;
    }
}

module.exports = onError;