mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
Merge error and fatal
This commit is contained in:
parent
e857eb1b47
commit
9ebb95c69d
7 changed files with 17 additions and 20 deletions
|
|
@ -16,15 +16,15 @@ module.exports = require('./protocols/core').extend({
|
|||
token: this.options.token
|
||||
}
|
||||
}, function(e,r,body) {
|
||||
if(e) return self.error('HTTP error');
|
||||
if(e) return self.fatal('HTTP error');
|
||||
var json;
|
||||
try {
|
||||
json = JSON.parse(body);
|
||||
} catch(e) {
|
||||
return self.error('Invalid JSON');
|
||||
return self.fatal('Invalid JSON');
|
||||
}
|
||||
|
||||
if(json.status != 200) return self.error('Invalid status');
|
||||
if(json.status != 200) return self.fatal('Invalid status');
|
||||
|
||||
json.players.forEach(function(one) {
|
||||
state.players.push({name:one.nickname,team:one.team});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue