Handle missing / no longer avail message

This commit is contained in:
Bryan Ashby 2016-06-20 14:41:43 -06:00
parent 05cf2c24ca
commit 81301047b3
1 changed files with 8 additions and 1 deletions

View File

@ -243,7 +243,14 @@ Message.prototype.load = function(options, cb) {
'WHERE message_uuid=? ' + 'WHERE message_uuid=? ' +
'LIMIT 1;', 'LIMIT 1;',
[ options.uuid ], [ options.uuid ],
function row(err, msgRow) { (err, msgRow) => {
if(err) {
return callback(err);
}
if(!msgRow) {
return callback(new Error('Message (no longer) available'));
}
self.messageId = msgRow.message_id; self.messageId = msgRow.message_id;
self.areaTag = msgRow.area_tag; self.areaTag = msgRow.area_tag;
self.messageUuid = msgRow.message_uuid; self.messageUuid = msgRow.message_uuid;