lib/nfs/Connection: use new class NfsClientError

Allows callers to extract the NFS error code.
This commit is contained in:
Max Kellermann
2018-07-06 19:01:30 +02:00
parent 30900b2fe2
commit 86e2075c63
5 changed files with 146 additions and 1 deletions

View File

@@ -21,6 +21,11 @@
#include "Error.hxx"
#include "system/Error.hxx"
#ifdef ENABLE_NFS
#include "lib/nfs/Error.hxx"
#include <nfsc/libnfs-raw-nfs.h>
#endif
bool
IsFileNotFound(std::exception_ptr ep)
{
@@ -28,6 +33,10 @@ IsFileNotFound(std::exception_ptr ep)
std::rethrow_exception(ep);
} catch (const std::system_error &e) {
return IsFileNotFound(e);
#ifdef ENABLE_NFS
} catch (const NfsClientError &e) {
return e.GetCode() == NFS3ERR_NOENT;
#endif
} catch (...) {
}