sapling/eden/fs/prjfs/PrjfsRequestContext.cpp
Xavier Deguillard bc56270443 prjfs: only send a notification on future timeout
Summary:
When compiling with Buck, it tries to create hardlink which are rightfully
failing, but that error then triggers a spurious notification. For now, let's
only notify the user on timeout, as these are very likely to be network issues.

Reviewed By: kmancini

Differential Revision: D25500364

fbshipit-source-id: 95b609ae901fa6207c8edba26cd8e6a21ddfe3ac
2020-12-15 18:13:01 -08:00

34 lines
891 B
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#ifdef _WIN32
#include "eden/fs/prjfs/PrjfsRequestContext.h"
namespace facebook::eden {
void PrjfsRequestContext::handleException(
folly::Try<folly::Unit> try_,
Notifications* FOLLY_NULLABLE notifications) const {
XDCHECK(try_.hasException());
auto* exc = try_.tryGetExceptionObject<std::exception>();
sendError(exceptionToHResult(*exc));
if (auto* err = dynamic_cast<const folly::FutureTimeout*>(exc)) {
XLOG_EVERY_MS(WARN, 1000)
<< "Prjfs request timed out: " << folly::exceptionStr(*err);
if (notifications) {
notifications->showGenericErrorNotification(*err);
}
} else {
XLOG(DBG5) << folly::exceptionStr(*exc);
}
}
} // namespace facebook::eden
#endif