fix crash on 500 error in getMessageAuthor
This commit is contained in:
parent
68494c66b7
commit
adc253045b
1 changed files with 5 additions and 0 deletions
5
app.js
5
app.js
|
@ -533,6 +533,11 @@ const getMessageAuthor = (thingId, accessToken, callback) => {
|
|||
return callback(e, null);
|
||||
}
|
||||
|
||||
// possible 500 error
|
||||
if (!response || !response.data || !response.data.children) {
|
||||
return callback(new Error('Could not retrieve the message author info.'), null);
|
||||
}
|
||||
|
||||
return callback(null, (response.data.children.length > 0) ? response.data.children[0].data.author : null);
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue