From 72b60077c7141b0c3ed97ce1d656e72ac2317df6 Mon Sep 17 00:00:00 2001 From: Beaudan Brown Date: Tue, 29 Oct 2019 12:20:04 +1100 Subject: [PATCH] Give a simple error instead of logging a failed null check --- libtextsecure/sendmessage.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libtextsecure/sendmessage.js b/libtextsecure/sendmessage.js index 613954c56be..f55b14f7606 100644 --- a/libtextsecure/sendmessage.js +++ b/libtextsecure/sendmessage.js @@ -203,7 +203,13 @@ MessageSender.prototype = { ({ server } = this); } - const { url, id } = await server.putAttachment(attachmentData); + const result = await server.putAttachment(attachmentData); + if (!result) { + return Promise.reject( + new Error('Failed to upload data to attachment fileserver') + ); + } + const { url, id } = result; proto.id = id; proto.url = url; proto.contentType = attachment.contentType;