From d8bc02ce46de06d568d0aff021c94f6b764368e1 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Fri, 30 Sep 2022 23:55:28 -0600 Subject: [PATCH] Catch timestamp error --- core/msg_list.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/msg_list.js b/core/msg_list.js index e94f1bae..19d8f78c 100644 --- a/core/msg_list.js +++ b/core/msg_list.js @@ -315,9 +315,16 @@ exports.getModule = class MessageListModule extends ( let msgNum = 1; self.config.messageList.forEach((listItem, index) => { listItem.msgNum = msgNum++; - listItem.ts = moment(listItem.modTimestamp).format( - dateTimeFormat - ); + try { + listItem.ts = moment(listItem.modTimestamp).format( + dateTimeFormat + ); + } catch (e) { + self.client.log.warn( + `Error parsing "${listItem.modTimestamp}"; expected timestamp: ${e.message}` + ); + listItem.ts = moment().format(dateTimeFormat); + } const isNew = _.isBoolean(listItem.isNew) ? listItem.isNew : listItem.messageId > self.lastReadId;