Don't show the status code if there's no response at all;
This commit is contained in:
parent
84c2b37469
commit
174aacba41
5
index.js
5
index.js
@ -48,7 +48,10 @@ if (config.lstu) {
|
|||||||
body = {err: 'cant parse JSON'};
|
body = {err: 'cant parse JSON'};
|
||||||
}
|
}
|
||||||
if (err || !body.success) {
|
if (err || !body.success) {
|
||||||
console.error("Error when shortening link: (status: " + res.statusCode + ")", '\nerror:', err, '\nfailure reason:', body.msg);
|
console.error("Error when shortening link: ",
|
||||||
|
res ? "(status: " + res.statusCode + ")" : "(no response)",
|
||||||
|
'\nerror:', err,
|
||||||
|
'\nfailure reason:', body.msg);
|
||||||
} else {
|
} else {
|
||||||
callback(body.short);
|
callback(body.short);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user