From 9782e3eea9a36b31e8fd10b04ae061815fbc8d6e Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Thu, 28 Mar 2024 05:01:39 -0400 Subject: [PATCH] wsd: more accurate load error message Since we have a more accurate reason for failing to load, that's what we should always return. Change-Id: If9d38cf6de6d41310ba94857efcd073e3f4ef8b7 Signed-off-by: Ashod Nakashian --- test/UnitWopiOwnertermination.cpp | 16 +++------------- wsd/RequestVettingStation.cpp | 5 ++--- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/test/UnitWopiOwnertermination.cpp b/test/UnitWopiOwnertermination.cpp index 2f6d60003e..c953faad9b 100644 --- a/test/UnitWopiOwnertermination.cpp +++ b/test/UnitWopiOwnertermination.cpp @@ -82,21 +82,11 @@ public: bool onDocumentError(const std::string& message) override { LOK_ASSERT_STATE(_phase, Phase::WaitLoadStatus); - if (message != "error: cmd=internal kind=load") - { - LOK_ASSERT_EQUAL_MESSAGE("Expect only documentunloading errors", - std::string("error: cmd=load kind=docunloading"), message); - } - else - { - // We send out two errors when we fail to load. - // This is the second one, which is 'cmd=internal kind=load'. - LOK_ASSERT_EQUAL_MESSAGE("Expect only documentunloading errors", - std::string("error: cmd=internal kind=load"), message); + LOK_ASSERT_EQUAL_MESSAGE("Expect only documentunloading errors", + std::string("error: cmd=load kind=docunloading"), message); - TRANSITION_STATE(_phase, Phase::Done); - } + TRANSITION_STATE(_phase, Phase::Done); return true; } diff --git a/wsd/RequestVettingStation.cpp b/wsd/RequestVettingStation.cpp index 3b7a2e11ed..dc5cb7b458 100644 --- a/wsd/RequestVettingStation.cpp +++ b/wsd/RequestVettingStation.cpp @@ -327,11 +327,10 @@ bool RequestVettingStation::createDocBroker(const std::string& docKey, const std } // Failed. - LOG_ERR("Failed to create DocBroker [" << docKey << ']'); + LOG_ERR("Failed to create DocBroker [" << docKey << "]: " << error); if (_ws) { - sendErrorAndShutdown(_ws, "error: cmd=internal kind=load", - WebSocketHandler::StatusCodes::UNEXPECTED_CONDITION); + sendErrorAndShutdown(_ws, error, WebSocketHandler::StatusCodes::UNEXPECTED_CONDITION); } return false;