1
0
Fork 0

fixed issue #4045: fix misleading error message in arangorestore (#4049)

This commit is contained in:
Jan 2017-12-16 15:18:35 +01:00 committed by GitHub
parent 5878d8184e
commit a3d169eb5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 6 deletions

View File

@ -539,9 +539,14 @@ int DumpFeature::runDump(std::string& dbName, std::string& errorMsg) {
endEncryption(fd);
TRI_TRACKED_CLOSE_FILE(fd);
} catch (basics::Exception const& ex) {
errorMsg = ex.what();
return ex.code();
} catch (std::exception const& ex) {
errorMsg = ex.what();
return TRI_ERROR_INTERNAL;
} catch (...) {
errorMsg = "out of memory";
return TRI_ERROR_OUT_OF_MEMORY;
}

View File

@ -394,6 +394,12 @@ int RestoreFeature::processInputDirectory(std::string& errorMsg) {
} else {
encryptionType = "none";
}
} catch (basics::Exception const& ex) {
errorMsg = ex.what();
return ex.code();
} catch (std::exception const& ex) {
errorMsg = ex.what();
return TRI_ERROR_INTERNAL;
} catch (...) {
// file not found etc.
}

View File

@ -161,9 +161,6 @@ void ShellFeature::start() {
ok = shell->jslint(_jslint);
break;
}
} catch (basics::Exception const& ex) {
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "caught exception " << ex.what();
ok = false;
} catch (std::exception const& ex) {
LOG_TOPIC(ERR, arangodb::Logger::FIXME) << "caught exception " << ex.what();
ok = false;

View File

@ -396,7 +396,11 @@ std::vector<std::string> listFiles(std::string const& directory) {
handle = _findfirst(filter.c_str(), &fd);
if (handle == -1) {
return result;
TRI_set_errno(TRI_ERROR_SYS_ERROR);
int res = TRI_errno();
std::string message("failed to enumerate files in directory '" + directory + "': " + strerror(res));
THROW_ARANGO_EXCEPTION_MESSAGE(res, message);
}
do {
@ -412,7 +416,11 @@ std::vector<std::string> listFiles(std::string const& directory) {
DIR* d = opendir(directory.c_str());
if (d == nullptr) {
return result;
TRI_set_errno(TRI_ERROR_SYS_ERROR);
int res = TRI_errno();
std::string message("failed to enumerate files in directory '" + directory + "': " + strerror(res));
THROW_ARANGO_EXCEPTION_MESSAGE(res, message);
}
dirent* de = readdir(d);