From 81301047b3041be0040dad7052774f709cecedc5 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Mon, 20 Jun 2016 14:41:43 -0600 Subject: [PATCH] Handle missing / no longer avail message --- core/message.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/message.js b/core/message.js index 9323b790..9bffe415 100644 --- a/core/message.js +++ b/core/message.js @@ -243,7 +243,14 @@ Message.prototype.load = function(options, cb) { 'WHERE message_uuid=? ' + 'LIMIT 1;', [ 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.areaTag = msgRow.area_tag; self.messageUuid = msgRow.message_uuid;