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 <ashod.nakashian@collabora.co.uk>
pull/8691/head
Ashod Nakashian 2024-03-28 05:01:39 -04:00 committed by Michael Meeks
parent 21c3b4d3ed
commit 9782e3eea9
2 changed files with 5 additions and 16 deletions

View File

@ -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;
}

View File

@ -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;